<template>
  <div class="c-bg-sgray shopDetail" :class="{'theme-market': showMarketingBar}">
    <div class="c-p">
      <swiper v-if="swiperList.length > 0" id="mySwiper" ref="mySwiper" :options="swiperOption" class="c-bg-white c-p">
        <swiper-slide v-for="(item, index) in swiperList" :key="index" class="c-p">
          <div @click="clickSwiperImg(index)">
            <img :class="'swiper-img' + index" class="c-w100" :src="$addXossFilter(item.url)">
          </div>
          <div @click="clickSwiperImg(0)" class="c-pa c-p-t0 c-w100 c-h c-flex-row c-flex-center" v-show="videoInfo != null && index == 0">
            <i class="iconfont c-fc-white c-fs100">&#xe869;</i>
          </div>
        </swiper-slide>
        <div class="swiper-pagination" slot="pagination">
          <div class="c-pa c-p-r0 c-p-b0 c-pr24 c-ww100 c-pb28 c-flex-row c-justify-end">
            <div class="swiper-page-tag c-fs20 c-flex-row c-flex-center">
              {{swiperIndex + 1}}/{{swiperList.length}}
            </div>
          </div>
        </div>
      </swiper>
      <div class="c-pa c-p-l24 c-p-t24 c-pz100" v-if="enableBuyedInfoSwiper==1&&buyerSwiperList.length>2">
        <buy-inforswiper :swiperList='buyerSwiperList'></buy-inforswiper>
      </div>
    </div>
    <!-- 营销活动倒计时 -->
    <flash-sales-time-new
      v-if="showMarketingBar"
      :type="!!presale ? 'isPreSale' : flashSales ? 'isSale':shopInfo.isFriendHelper ? 'isFa' : bargain ? 'isBargain' : 'isCollage'"
      :price="flashSales ? flashPrice : (collageInfo ? collagePrice : (bargain ? bargain.reservePrice : (presale ? (specItems && specItems.length > 0 ? currentSpecInfo.price : presale.aPrice) : '')))"
      :startTime="flashSales ? flashSales.sales.startTime : collageInfo ? collageInfo.startTime : bargain ? bargain.startTime : presale ? presale.depositStartTime : shopInfo.faStartAt"
      :endTime="flashSales ? flashSales.sales.endTime : collageInfo ? collageInfo.endTime : bargain ? bargain.endTime : presale ? presale.depositEndTime : shopInfo.faEndAt"
      :originalPrice="flashSales ? showOriginalPrice : (collageInfo ? collageOriginalPrice : (presale ? (specItems && specItems.length > 0 ? currentSpecInfo.originalPrice : presale.oPrice) : shopInfo.price))"
      :stockBargain="bargain && bargain.isLimitStock == 1 ? bargain.stock : dialogStock"
      :stock=" presale ? presale.stock : flashSales || collageInfo ? (dialogStock ? dialogStock : 0) : ''"
      :isLimit="(flashSales && flashSales.limit == 0) || (collageInfo && collageInfo.limit == 0) || (bargain && bargain.isLimitStock == 2) ? false : true"
      :salesTag="flashSales && flashSales.sales.tags"
      :peopleNum="collageInfo && collageInfo.peopleNum"
      :isPreheat="bargain && bargain.isPreheat"
      :deposit="presale ? (specItems && specItems.length > 0 ? currentSpecInfo.deposit : currentSpecDeposit) : 0"
      :bargainStatus="bargain && bargain.status"
      :from="'mall'"
      :optimal="optimal"
      @showCoupon="showCoupon = true"
      @falshSalesTime="falshSalesTime"
      @finishFlashSales="finishFlashSales"
    ></flash-sales-time-new>
    <price-bar
      v-if="!showMarketingBar"
      class="c-pt24 c-bg-white"
      :styleType="2"
      :dataInfo="shopInfo"
      :chainInfo="chainInfo"
    >
    </price-bar>
    <!-- 不展示身份折扣条件：预售营销活动隐藏优惠信息 -->
    <discount-info
      v-if="!presale"
      class="c-bg-white c-pt20"
      :couponList="couponList"
      :isMarketing="showMarketingBar"
      :dataInfo="shopInfo"
      :chainInfo="chainInfo"
      @clickShowCoupon="showCoupon = true"
    >
    </discount-info>
    <vip-entry
      v-if="!presale"
      :styleType="2"
      :customClass="'c-bg-white c-ph24 c-pt20'"
      :dataInfo="shopInfo"
    ></vip-entry>
    <div class="c-flex-column c-ph24 c-pt24 c-pb24 c-bg-white">
      <div class="c-fs26 c-fc-xblack c-fw600 c-flex-grow1 c-lh32">{{shopInfo.name}}</div>
      <div class="c-fs20 c-fc-gray c-flex-shrink0 c-mt16">已售{{shopInfo.sales}}件</div>
      <!-- 引导入群 -->
      <invite-group class="c-pr24 c-mt24"
        v-if="guideData && guideData.isOpenGuide == 1 && guideData.guideType.includes(1)"
        :guideText="guideData.guideDesc"
        @handleShowGuidePop="handleShowGuidePop"
      >
      </invite-group>
    </div>
    <!-- 非强制表单入口 -->
    <formEntry v-if="(collectPage==3 && isRelForm == true && hasFormLog == false && isShowFormlg)||(hasFormLog&&enableEdit==2&& isShowFormlg&& isRelForm == true)"
      relType="19"  :relId="ShopId"  :dataInfo="{hasFormLog:hasFormLog, enableEdit:enableEdit}"
      classObject="c-fs22" fontSizeClass="c-fs20" iconSizeClass="c-fs14" topClass="c-bd-t12-f5 c-bg-white"
      @goForm="goForm" ></formEntry>
    <div class="c-bg-white c-mt12" v-if="collageInfo && collageInfo.groupList && collageInfo.groupList.length > 0">
      <div class="c-bg-white c-ph24 c-pt24">
        <div class="c-flex-row c-justify-sb c-pb28">
          <div class="c-fs22 c-fc-xblack">以下小伙伴正在拼团</div>
          <div @click="showHideOnBlur = true;getMoreCollage(collageInfo.collageId,0);" class="c-fs22 c-fc-gray">全部拼团 <span class="iconfont c-fs18  c-fc-gray">&#xe986;</span></div>
        </div>
        <div v-for="(item, index) in collageInfo.groupList" :key="index" class="c-flex-row c-aligni-center c-justify-sb c-pb28">
          <img class="c-ww80 c-hh80 c-br40" :src="$addXossFilter(item.headimgurl, require('../../../assets/defult_head.png'))" alt="">
          <div class="c-flex-column c-justify-sb c-w0 c-flex-grow1 c-ml20">
            <div class="c-fs24 c-fc-xblack">还差<span class="c-fs24 fc-benefit">{{item.lastPeopleNum}}人</span>成团</div>
            <div class="c-fs20 c-fc-gray c-mt10">剩余<cj-clocker :time="item.endTime" format="%D天%H时%M分%S秒" @on-finish="item.status = 3;"></cj-clocker></div>
          </div>
          <div class="theme-bg c-fs22 c-fc-white c-ww110 c-hh44 c-br25 c-flex-row c-flex-center" @click="goGroup(item.groupId)">去参团</div>
        </div>
        <div class="c-pv24 c-bd-t1">
          <span class="c-fs24 c-fc-gray">玩法</span><span class="c-fs22 c-fc-gray c-ml24">开团/参团 - 邀请好友 - 满员成团（购买成功）</span>
        </div>
      </div>
    </div>

    <div class="c-bg-white c-mt10 c-flex-column" v-if="presale" >
      <div class="c-flex-row c-ph24">
        <div class="c-fs24 c-fc-gray c-pt18">尾款</div>
        <div class="c-ml24 c-bd-b1 c-w0 c-flex-grow1 c-pv18">
          <div class="c-fs24 theme-fc">{{'￥' | iosPriceFilter}}{{(showPrice - currentSpecDeposit) | toMyFixed2}}</div>
          <div class="c-fs22 c-fc-gray c-mt8">支付时间（{{getLeaveTime()}}）</div>
        </div>
      </div>
      <div class="c-flex-row c-aligni-center c-ph24">
        <div class="c-fs24 c-fc-gray">流程</div>
        <div class="c-ml24 c-bd-b1 c-w0 c-flex-grow1 c-flex-row c-aligni-center c-pv24">
          <span class="c-fs24 c-fc-gray">1.付定金 - 2.付尾款 - 3.发货</span>
          <!-- <span class="iconfont c-fs22 fc-D8D8D8 c-ml10">&#xe762;</span> -->
        </div>
      </div>
    </div>
    <!-- 满减/套餐赠品 -->
    <discount-tip
      v-if="(cashBack && cashBack.contents) || (relData && relData.length > 0)"
      :ckFrom="12"
      :cashBack="cashBack ? cashBack.contents : []"
      :relData="relData"
      @clickShowRelData="clickShowRelData"
      @clickCashBack="showCoupon = true"
      class="c-bg-white"
    ></discount-tip>
    <bargain-rules v-if="bargain" :isPreheat="bargain.isPreheat" :status="bargain.status" class="c-bd-t12-f5">
      <template slot="title"><span class="c-fs24 c-fc-gray c-fw-n c-mr24">玩法</span></template>
      <template slot="desc"><div class="c-fs24 c-fc-gray">超低价购买心仪商品</div></template>
    </bargain-rules>
    <div class="c-bg-white c-mt12 c-flex-column">
      <div class="c-flex-row c-ph24"v-if="showSpecificationsArea" @click="checkDefaultSpec">
        <div class="c-fs24 c-fc-gray c-pv24 c-flex-row">
          <div class="c-flex-row c-aligni-center c-hh60">规格</div>
        </div>
        <div class="c-flex-row c-ml24 c-w0 c-flex-grow1 c-pv24" :class="(shopInfo.province || shopInfo.city) || (isMallExpressDeliver == 1) || (attributeInfo && attributeInfo.length>0) || (tags && tags.length > 0) ? 'c-bd-b1-f5f5f5' : ''">
          <div class="c-text-ellipsis1 c-flex-grow1 c-w0 c-fs22 c-fc-xblack">
            <div class="c-flex-row c-aligni-center c-justify-sb">
              <div class="c-flex-row c-aligni-center c-hh60 c-lh60">
                <div class="c-ww56 c-hh56 c-br8 c-mr8 theme-bd2 c-text-hidden" v-if="selectTypeInfoTxt && selectTypeImg"><img class="c-h c-w100" :src="selectTypeImg" alt=""></div>
                <div v-for="(item, index) in specItemInfos.filter((item, index) => {return item.gsiiId != dialogGsiiId})" :key="index">
                  <img v-if="item.gsiPicture && (index < (selectTypeInfoTxt ? 3 : 4))" class="c-ww56 c-hh56 c-br4 c-mr8" :src="item.gsiPicture" alt="">
                </div>
              </div>
              <div class="c-text-ellipsis1 c-w0 c-flex-grow1 c-pr8 c-fc-gray" :class="(specItemInfos.filter((item, index) => {return item.gsiiId != dialogGsiiId && item.gsiPicture}).length > 0) || (selectTypeInfoTxt && selectTypeImg) ? 'c-textAlign-r' : ''">
                共{{specItemInfos.length}}种{{specs && specs.length > 0 ? specs[0].name : ''}}可选
              </div>
              <div>
                <span class="iconfont c-fs24 c-fc-gray c-lh48 c-pt6 c-ph2">&#xe635;</span>
              </div>
            </div>
            <div v-if="selectTypeInfoTxt" class="c-lh36 c-mt20 c-fs24 c-text-ellipsis1">已选：{{selectTypeInfoTxt}}</div>
          </div>

        </div>
      </div>

      <div class="c-flex-row c-ph24" v-if="isMallExpressDeliver == 1">
        <div class="c-fs24 c-fc-gray c-pv24">运费</div>
        <div class="c-ml24 c-pv24 c-text-ellipsis1 c-flex-grow1 c-w0 c-fs24 c-fc-xblack c-flex-column" :class="(attributeInfo && attributeInfo.length>0) || (tags && tags.length > 0) ? 'c-bd-b1-f5f5f5' : ''">
          <div v-if="freeShipping == 0">全场包邮</div>
          <template v-else-if="shopInfo.freightMode == 0">
            <div v-if="shopInfo.postage * 1 == 0">包邮</div>
            <div v-else>{{shopInfo.postage + '元'}}</div>
          </template>
          <template v-else-if="shopInfo.freightMode == 1">
            <div v-if="shopInfo.postage * 1 == 0 && shopInfo.valuationMethod != 2">包邮（偏远地区除外）</div>
            <div v-else :class="shopInfo.freightRule ? 'c-flex-row c-justify-sb c-aligni-center c-w100' : ''">
              <span v-if="shopInfo.valuationMethod == 0">按件计费</span>
              <span v-else-if="shopInfo.valuationMethod == 2">到付，运费以实际配送费用为准</span>
              <span v-else>按重量计费</span>
              <span v-if="shopInfo.freightRule" @click="showPostage = true" class="iconfont c-fs24 c-fc-gray c-hh24 c-lh24">&#xe635;</span>
            </div>
          </template>
          <!-- 优惠政策是全局设置的，有才显示分割线 发货日期 -->
          <div v-if="(shopInfo.province || shopInfo.city) || (shopInfo.freightMode == 0 && shopInfo.postage * 1 != 0)" class="c-pt8 c-flex-grow1 c-w100 c-fs22 c-fc-gray c-flex-row c-aligni-center c-flexw-wrap">
            <div v-if="shopInfo.province || shopInfo.city">{{shopInfo.province + shopInfo.city}}发货</div>
            <span v-if="shopInfo.freightMode == 0 && shopInfo.postage * 1 != 0 && (shopInfo.province || shopInfo.city)" class="c-ph6">|</span>
            <span v-if="shopInfo.freightMode == 0 && shopInfo.postage * 1 != 0"> {{freeShipping && freeShipping != 0 ? '优惠政策：满' +freeShipping+ '，享包邮' : ''}}</span>
          </div>

        </div>
      </div>

      <div class="c-flex-row c-aligni-center c-ph24" v-if="attributeInfo && attributeInfo.length>0">
        <div class="c-fs24 c-fc-gray">参数</div>
        <div class="c-flex-row c-aligni-center c-ml24 c-w0 c-flex-grow1 c-pv24" :class="tags && tags.length > 0 ? 'c-bd-b1-f5f5f5' : ''">
          <div class="c-text-ellipsis1 c-flex-grow1 c-w0 c-fs24 c-fc-xblack">
            <span v-for="(item, index) in attributeInfo" :key="index">
              <span class="c-fc-xblack">{{ item.k }}</span>
              <span v-if="index<attributeInfo.length-1" class="c-fc-gray"> · </span>
            </span>
          </div>
          <a class="iconfont c-fs24 c-fc-gray c-hh36 c-lh36 c-pl24 c-ph2" @click="jumpToAnchor" href="#goodParams">&#xe635;</a>
        </div>
      </div>
      <div class="c-flex-row c-aligni-center c-ph24" v-if="tags && tags.length > 0" @click="showServer = true">
        <div class="c-fs24 c-fc-gray">服务</div>
        <div class="c-flex-row c-aligni-center c-justify-sb c-ml24 c-w0 c-flex-grow1 c-pv24">
          <div class="c-text-ellipsis1 c-flex-grow1 c-w0 c-fs24 c-fc-xblack">
            <span v-for="(item,index) in tags" :key="index">
              <span class="c-fc-xblack">{{ item.name }}</span>
              <span v-if="index < attributeInfo.length-1" class="c-fc-gray"> · </span>
            </span>
          </div>
          <span class="iconfont c-fs24 c-fc-gray c-hh36 c-lh36 c-pl24 c-ph2">&#xe635;</span>
        </div>
      </div>
    </div>
    <!-- 商品评论 -->
    <div v-if="commentsTotal>0" class="c-flex-row c-aligni-center c-justify-sb c-ph24 c-bg-white c-pv24 c-bd-t12-f5">
      <div class="c-fs24 c-lh34 c-fc-xblack">商品评价{{commentsTotal > 0 ? '(' + commentsTotal + ')' : ''}}</div>
      <div class="c-fs22 c-flex-row c-aligni-center" :class="commentsTotal > 0 ? 'theme-fc' : 'c-fc-gray'" @click="goCommentList()">
        {{commentsTotal > 0 ? '查看全部' : '暂无评价'}}
        <span class="iconfont c-fs10 theme-fc c-fs24 c-ph2" v-if="commentsTotal > 0">&#xe635;</span>
      </div>
    </div>
    <div class="c-pb24 c-ph24 c-bg-white" v-if="commentsTotal > 0">
      <div class="c-flex-row c-aligni-center c-justify-sb">
        <div class="c-flex-row c-aligni-center">
          <div class="c-flex-row c-aligni-center">
            <img :src="$addXossFilter(shopTopComment.headimgurl, require('@/assets/defult_head.png'))" class="c-brp50 img-pe-none c-ww40 c-hh40 c-mr12">
            <span class="c-fs22 c-fc-xblack" v-if="shopTopComment.isAnonymous == 1 && shopTopComment.nickname">匿名</span>
            <span class="c-fs22 c-fc-xblack c-maxw200 c-text-ellipsis1" v-else>{{nameLength(shopTopComment.nickname, 2)}}</span>
          </div>
          <div class="c-flex-row c-aligni-center c-ml12" v-if="shopTopComment.isAcquiesceComment == 0">
            <div class="c-flex-row c-aligni-center">
              <span class="c-fs24 iconfont c-ml12" :class="shopTopComment.starRank >= index ? 'theme-fc' : 'c-fc-e6'" v-for="index in 5" :key="index">&#xe8c7;</span>
            </div>
          </div>
        </div>
        <div class="c-fs22 c-lh32 c-fc-sgray">{{shopTopComment.createdAt}}</div>
      </div>
      <div class="c-flex-column c-justify-sb">
        <div class="c-fs22 c-fc-xblack c-mt12 c-text-ellipsis2">{{!shopTopComment.words && shopTopComment.isAcquiesceComment == 0 ? '未填写评语' : (shopTopComment.isAcquiesceComment == 1 && shopTopComment.isUpdated == 0 ? '默认好评' : shopTopComment.words)}}</div>
        <div id="picScroll" v-if="shopTopComment.pictures" class="c-pb24 c-w100 c-contexty-hidden c-contextX-scroll c-ws-n c-mt12">
          <span v-for="(item, index) in shopTopComment.pictures" :key="index" @click="clickPreviewImage(index, item, shopTopComment.pictures)" class="c-mr12 c-inlineblack c-vcAlign-middle c-flex-row c-aligni-center c-br4 c-text-hidden c-ww160 c-hh160">
            <img :src="$addXossFilter(item)" class="c-object-fit-cover c-w100 c-h">
          </span>
        </div>
      </div>
    </div>

    <div id="divShopDetail" class="c-mt12 c-bg-white c-ph30 c-minh640" :class="recommendList && recommendList.length > 0 ? 'c-mb10' : ''">
      <my-small-tabbar id="tabhBar" styleType="2" tabIndex="0" class="c-p c-bg-white" :isNew="true" :tabNameClass="'c-fs24'" :tabList="descList" ></my-small-tabbar>
      <course-description
        ref="descriptions"
        :independentCopy="cfg.isCopy"
        :independentCopyPicture="cfg.isCopyPicture"
        :prodType="ckFrom.shopping"
        :prodId="shopInfo.mgId"
      ></course-description>
    </div>
    <div class="c-pv24 c-bd-t12-f5 c-ph30 c-bg-white" id="goodParams" v-if="attributeInfo && attributeInfo.length > 0">
      <div class="c-fs26 c-fc-xblack c-p c-fw600">
        <span class="c-p c-pz6">参数</span><i class="c-pa c-p-l0 c-p-b0 c-hh8 c-ww48 c-br4 theme-bg"></i>
      </div>
      <table class="custom-table c-w100 c-mt24">
        <tr class="c-flex-row c-w100 c-aligni-center" :class="index == shopInfo.attributes.length - 1 ? '' : 'bd-b1-E7E7E7'" v-for="(item,index) in shopInfo.attributes" :key="index">
          <td class="custom-cell c-fs24 ww154 bd-r1-E7E7E7">{{item.k}}</td>
          <td class="custom-cell c-fs24 c-flex-1">{{item.v}}</td>
        </tr>
      </table>
    </div>
    <!-- 相关商品推荐 -->
    <shop-recommend v-if="recommendList && recommendList.length > 0" :recommendList="recommendList"></shop-recommend>

    <div class="shop-buy-item c-box-shadowEdu c-flex-row c-justify-sb c-aligni-center">
      <!-- 邀请赚钱 -->
      <div class="c-flex-row c-aligni-center c-ml16 c-mr16">
        <div class="c-flex-column c-flex-center c-p c-ww80 c-wb-ba" @click="clickCart">
          <circle-count :count="cartNum"  :coordinate="[1, -0.1]" :maxShowNumber="true"></circle-count>
          <i class="iconfont c-fs40 icon-gouwuche3 c-fc-sblack"></i>
          <div class="c-lh c-fs16 c-fc-sblack c-mt4">购物车</div>
        </div>
      </div>
      <div class="c-flex-1 c-fc-white c-fs24 c-hh64 c-flex-row c-flex-center c-br32 c-bg-ccc c-mr24" v-if="dialogStock == 0">
        商品已抢完，暂时缺货
      </div>
      <div class="c-flex-1 c-fc-white c-fs24 c-hh64 c-flex-row c-flex-center c-br32 c-bg-ccc c-mr24" v-else-if="dialogStock > 0 && shopInfo.isAssignUser == 0">
        仅限特定用户购买
      </div>
      <div class="c-flex-1 c-fc-white c-fs24 c-hh64 c-flex-row c-flex-center c-br32 c-bg-ccc c-mr24" v-else-if="(shopInfo.limitType != -1 && shopInfo.isReachedLimit == 1 && dialogStock > 0 && shopInfo.isAssignUser == 1 && presale == null) || (dialogStock > 0 && presale && presale.limit > 0 && (presale.limit - presale.buyCount <= 0))">
        已达到限购数量
      </div>
      <div v-else class="c-w0 c-flex-grow1 c-flex-row c-aligni-center">
        <div v-if="groupInfo && groupInfo.status == 2 && groupInfo.joinStatus == 0" @click="goGroup(groupId)" class="c-flex-row c-flex-center c-hh64 c-flex-1 c-br32 theme-bg-gradient c-mr24">
          <div class="c-flex-row c-aligni-center">
            <div class="c-ww52 c-hh52 c-text-hidden c-bd1-white c-brp50">
              <img class="c-w100" :src="$addXossFilter(groupInfo.headimgurl, require('../../../assets/defult_head.png'))" alt="">
            </div>
            <div class="c-ml8">
              <div class="c-fs20 c-fc-white c-textAlign-c">参与他的拼团</div>
              <div class="c-fs20 c-fc-white">剩余<cj-clocker :time="timeFn()" @on-finish="finishFn()"><template v-slot="{ timeInfo }"><span><span>{{timeInfo.D}}</span>:<span>{{timeInfo.H}}</span>:<span>{{timeInfo.M}}</span>:<span>{{timeInfo.S}}</span></span></template></cj-clocker></div>
            </div>
          </div>
        </div>
        <div class="c-pr24 c-flex-row c-w100 c-aligni-center c-w0 c-flex-grow1" v-else-if="collageInfo">
          <!-- <div class="c-hh64 c-ww76 c-flex-row c-flex-center theme-bg-10 c-br32 c-mr24" @click="clickJoinCart">
            <i class="iconfont c-fs36 theme-fc">&#xe722;</i>
          </div> -->
          <div class="c-w0 c-flex-grow1 c-hh64 c-br32 c-flex-row c-aligni-center c-text-hidden">
            <div class="theme-bg-10 theme-fc c-w50 c-h c-flex-center c-flex-column c-aligni-center c-pv4" @click="clickBuyNow('cart')">
              <span class="c-fs20">{{getBuyBtnTitle}}</span>
              <span class="c-fs26 c-lh" v-if="optimal"><span class="c-fs20">{{'￥' | iosPriceFilter}}</span>{{optimal.optimalPriceType == 102 ? showPrice : optimal.optimalPrice}}</span>
            </div>
            <div @click="clickBuyNow('fromCollage')" class="c-fc-white theme-bg-gradient c-w50 c-h c-flex-center c-flex-column c-aligni-center c-pv4">
              <span class="c-fs20">发起拼团</span>
              <span class="c-fs26 c-lh"><span class="c-fs20">{{'￥' | iosPriceFilter}}</span>{{Number(collagePrice).toFixed(2)}}</span>
            </div>
          </div>
        </div>
        <div class="c-mr24 c-flex-row c-aligni-center c-flex-1 c-br32 c-text-hidden" v-else-if="bargain && ((bargain.status == 1 && bargain.isPreheat == 1) || bargain.status == 2)">
          <div class="theme-fc c-w50 c-hh64 c-flex-column c-flex-center theme-fc theme-bg-10 c-pv4 c-fs20" @click="clickBuyNow('cart')">
            <span>{{getBuyBtnTitle}}</span><span class="c-fs26 c-lh" v-if="optimal"><span class="c-fs20">{{'￥' | iosPriceFilter}}</span>{{optimal.optimalPriceType == 112 ? showPrice : optimal.optimalPrice}}</span>
          </div>
          <div class="c-hh64 c-w50 c-flex-column c-flex-center c-fc-white c-pv4 theme-bg-gradient c-fs20" :class="bargain && bargain.status == 1 && bargain.isPreheat == 1 ? 'c-bg-ccc' : 'theme-bg'" @click="clickBargainBuy()">
            <template v-if="bargain.userType == 1"><span class="c-fs24">正在砍价</span></template>
            <template v-else>
              <span>砍价享</span><span class="c-fs26 c-lh"><span class="c-fs20">{{'￥' | iosPriceFilter}}</span>{{Number(bargain.reservePrice).toFixed(2)}}</span>
            </template>
          </div>
        </div>
        <div class="c-mr24 c-flex-row c-aligni-center c-flex-1 c-br32 c-text-hidden" v-else>
          <div v-if="presale" class="c-flex-1 c-fc-white c-fs24 c-hh64 c-flex-column c-flex-center theme-bg-gradient" @click="clickBuyNow">
            <div class="c-fs20 c-fc-white c-lh28">支付定金</div>
            <div class="c-fs20 c-fc-white c-lh28">{{getLeaveTime(1)}}截止</div>
          </div>
          <template v-else>
            <div class="c-fs24 theme-bg-10 theme-fc c-w50 c-hh64 c-flex-row c-flex-center" @click="clickJoinCart">
              加入购物车
            </div>
            <div class="c-fc-white c-fs24 theme-bg c-w50 c-hh64 c-flex-column c-flex-center" @click="clickBuyNow">
              <span>立即购买</span>
            </div>
          </template>
        </div>
      </div>
    </div>

    <!-- 关联售卖列表弹窗 -->
    <mall-package-list :relData="relData" :showRelData="showRelData" :templateStyle="1" @clickShowRelData="clickShowRelData"></mall-package-list>


    <cj-popup v-model="showServer" round position="bottom" @close="showServer = false">
      <div class="cjpopBg c-ph16 c-minh50vh c-maxh80vh c-flex-column">
        <div class="c-flex-shrink0">
          <div class="c-flex-row c-aligni-center c-justify-center c-pv28">
            <img class="c-hh36" src="https://ck-bkt-knowledge-payment.oss-cn-hangzhou.aliyuncs.com/admin/material/14_material_admin/image/public/images/example-images/mall/serverTitle.png"/>
          </div>
          <div class="c-pa c-p-t28 c-p-r28">
            <div class="iconfont c-fc-gray c-fs20" @click="showServer = false">&#xeca0;</div>
          </div>
        </div>
        <div class="c-flex-grow1 c-contexty-scroll c-pb88 c-ph24 c-br-tl20 c-br-tr20 c-bg-white c-pt15">
          <div class="c-flex-row c-pv20 " v-for="(item,index) in tags" :key="index">
            <div class="c-bg-FDE1C6 c-brp50 c-ww40 c-hh40 c-flex-row c-aligni-center c-justify-center c-flex-shrink0">
              <i class="iconfont c-fc-EDA263 c-fs20">&#xe860;</i>
            </div>
            <div>
              <div class="c-pl24 c-fs24 c-mb10 c-fc-xblack">{{item.name}}</div>
              <div class="c-pl24 c-fs22 c-fc-gray c-mt16">{{item.tip}}</div>
            </div>
          </div>
        </div>
        <div class="c-flex-shrink0 c-pf c-p-l0 c-p-b0 c-ph24 c-pv10 c-w100 c-bg-white">
          <div class="c-fs28 c-textAlign-c c-br36 c-lh34 c-pv16 theme-bg c-fc-white" @click="showServer = false">完成</div>
        </div>

      </div>
    </cj-popup>

    <shop-spec ref="shopSpec" v-if="showSpecifications" @clickBuyNow="clickBuyNow" @confirmSpec="clickConfirmJoinCar" @clickBargainBuy="clickBargainBuy" @closeSpec="closeSpecModal" @dialogBuy="clickDialogBuy" @joinCart="clickDialogJoinCart"></shop-spec>

    <share-masker :isShowShare="isShowShare" v-if="isShowShare" @closeShare="isShowShare=false;"></share-masker>

    <!-- 视频播放器 -->
    <video-popup :showVideo="showVideo" @clickCloseVideo="clickCloseVideo" :videoSrc="currentVideoObj.videoSrc" :m3u8Url="currentVideoObj.m3u8Url"></video-popup>

    <!-- 优惠券满减折扣弹窗 -->
    <coupon-list-com
      :couponIsPage="couponIsPage"
      :couponLoading="couponLoading"
      :couponList="couponList"
      :showCoupon="showCoupon"
      :isMarketing='showMarketingBar'
      :dataInfo="shopInfo"
      :cashBack="cashBack ? cashBack.contents : null"
      :chainInfo="chainInfo"
      @clickCashBack="gocashBackAct(cashBack.mcbId)"
      @closeModal="closeModal"
      @getCouponList="getCouponList"
    >
    </coupon-list-com>

    <cj-popup v-model="showPostage" round>
      <div class="c-ww500">
        <h2 class="c-fs28 c-pv32 c-textAlign-c c-fc-xblack">运费详情</h2>
        <div class="c-fc-sblack c-fs24 c-textAlign-l c-ph40">{{shopInfo.freightRule}}</div>
        <div @click="showPostage = false" class="c-br14 c-pv16 c-ww220 c- c-flex-row c-flex-center theme-bg-gradient c-fc-white c-fs22 c-br30 c-mv32 c-m-0auto">我知道了</div>
      </div>
    </cj-popup>
    <cj-popup v-model="showHideOnBlur" round>
      <div class="c-ww570">
        <h2 class="c-fw-n c-fs28 c-pv32 c-bd-b1 c-textAlign-c c-fc-xblack">正在拼单</h2>
        <div class="c-ph24 c-maxh427 c-content-scroll">
          <div class="c-flex-row c-justify-sb c-aligni-center c-pv20 c-bd-b1" v-for="(item,index) in collageList" :key="index">
            <div class="c-flex-row">
              <img :src="$addXossFilter(item.headimgurl, require('../../../assets/defult_head.png'))" class="c-ww80 c-hh80 c-brp50" />
              <div class="c-flex-column c-hh80 c-justify-sa c-aligni-start c-ml16">
                <div class="c-fs20 c-fc-xblack">{{item.nickname}} 还差 <span class="theme-fc">{{item.lastPeopleNum}}</span> 人</div>
                <span class="c-fc-sblack c-fs18">剩余：<cj-clocker :time="item.endTime" format="%D天%H时%M分%S秒" @on-finish="item.status = 3;"></cj-clocker></span>
              </div>
            </div>
            <div class="theme-bg c-fc-white c-fs24 c-ph24 c-pv12 c-br36" @click="showHideOnBlur=false;goGroup(item.groupId)">去拼团</div>
          </div>
          <div class="c-fs18 c-fc-sblack c-textAlign-c c-pv20" @click="getMoreCollage(collageInfo.collageId,1)" v-if="is_collagePage">加载更多&nbsp;></div>
        </div>
      </div>
    </cj-popup>
    <!-- 关注二维码 -->
    <offical-account
      v-if="bargain"
      :showAccountQcode="showAccountQcode"
      :desc="'关注我们后才可发起砍价哦'"
      :imgSrc="$addXossFilter(mpQrcode)"
      @hideDialog="hideDialog"
    ></offical-account>

    <group-guidance ref="guidance" position="bottom" :isType="true" :groupObject="guideData" v-if="guideData"></group-guidance>
    <promote-income
      v-if="shopInfo && shopInfo.mgId"
      :showInvitionCard="!((bargain && ((bargain.status == 1 && bargain.isPreheat == 1) || bargain.status == 2)) || (collageInfo && collageInfo.status == 2) || (flashSales && flashSales.sales && flashSales.sales.status == 2))"
      :showMarketingCard="(bargain && ((bargain.status == 1 && bargain.isPreheat == 1) || bargain.status == 2)) || (collageInfo && collageInfo.status == 2) || (flashSales && flashSales.sales && flashSales.sales.status == 2)"
      :prodId="shopInfo.mgId"
      :prodType="ckFrom.shopping"
      @goInvite="clickShare"
      @goMarketingPoster="clickShare('activity')"
    ></promote-income>
  </div>
</template>

<script>
import 'swiper/dist/css/swiper.css'
import { swiper, swiperSlide } from 'vue-awesome-swiper'
import shareMasker from "@/components/templates/common/shareMasker.vue";
import ShopRecommend from "@/components/templates/shopRecommend.vue";
import couponListCom from "@/components/templates/couponListCom.vue";
import { utilJs, wxUtilJs } from "@/utils/common.js";
import FlashSalesTimeNew from "@/components/templates/flashSalesTimeNew.vue";
import MySmallTabbar from "@/components/templates/common/MySmallTabbar.vue";
import videoPopup from "@/components/templates/common/videoPopup.vue";
import DiscountTip from "@/components/templates/common/discountTip.vue";
import PriceBar from '@/components/templates/common/priceBar.vue';
import circleCount from "@/components/templates/common/circleCount.vue"
import buyInforswiper from '@/components/templates/buyInforswiper';
import shopSpec from "@/components/templates/shop/shopSpec.vue";
import mallPackageList from "@/components/templates/shop/mallPackageList.vue";
import bargainRules from '@/components/templates/bargain/bargainRules';
import officalAccount from '@/components/templates/common/officalAccount';
import courseDescription from '@/components/templates/courseDescription';
import groupGuidance from '@/components/templates/common/groupGuidance.vue'
import PromoteIncome from '@/components/templates/common/promoteIncome.vue';
import DiscountInfo from "@/components/templates/common/discountInfo.vue";
import { getBindPhoneSetting } from "@/utils/checkUnBindPhone.js";
import formEntry from "@/components/homePage/form/formEntry.vue"
import InviteGroup from "@/components/templates/common/inviteGroup.vue";
import VipEntry from "@/components/templates/common/vipEntry.vue";
let shopNo = "";
let isFromInteract = false;
const THEME_RGB_MAP = global.THEME_RGB_MAP;
export default {
  name: "ShopDetail",
  components: {
    swiper,
    swiperSlide,
    shareMasker,
    ShopRecommend,
    couponListCom,
    FlashSalesTimeNew,
    MySmallTabbar,
    DiscountTip,
    PriceBar,
    circleCount,
    buyInforswiper,
    videoPopup,
    shopSpec,
    mallPackageList,
    bargainRules,
    officalAccount,
    courseDescription,
    groupGuidance,
    PromoteIncome,
    DiscountInfo,
    formEntry,
    InviteGroup,
    VipEntry
  },
  props: [],
  watch: {
    $route: function (to, from) { // 监听路由，解决点击推荐的时候router.push不会跳转刷新页面
      if (to.path == '/mall/shopDetail/shopDetail' && from.path == '/mall/shopDetail/shopDetail') {
        this.initData();
      }
    }
  },
  data() {
    return {
      theme: localStorage.getItem("colorName") || "mb5_default",
      swiperIndex: 0, //轮播图index
      swiperOption: {
      },
      videoInfo: null, //视频地址
      showVideo: false,
      recommendList: [],
      companyAuth: JSON.parse(localStorage.getItem("companyAuth")),
      cfg: JSON.parse(localStorage.getItem("cfg")),
      isShowShare: false, //分享
      cartNum: 0,
      tabActive: "SHOP",
      showServer: false, //显示服务说明
      showSpecifications: false, //显示规格
      clickButtonType: "SPEC",
      tags: [], //商品标签
      attributeInfo: [], //商品属性信息
      showShareMoneyTip: true,
      freeShipping: "",
      showPrice: 0,
      showOriginalPrice: 0,
      groupInfo: "",
      shopInfo: {},
      selectTypeIndex: [],
      selectTypeInfo: "", //选择商品规格类型结果
      specInfo: "",
      specs: [], //商品规格一级分类
      specItems: [], //商品规格二级分类
      dialogPrice: "", //选择商品规格结果价格
      dialogOriginalPrice: "", //选择商品规格结果价格
      dialogStock: "", //选择商品规格结果库存
      dialogGsiiId: "", //选择商品规则结果ID
      selectShopNum: 1,
      defultBuyNum: 1,
      swiperList: [],
      flashSales: null,
      showSalesPrice: 0,
      showSalesStock: 0, //显示减去限购数可买的数量
      agentConfs: '',
      couponList: [],
      showCoupon: false,
      couponLoading: false,
      couponIsPage: false,
      couponPage: 1,
      showPostage: false, //模板邮费详情
      tabIndex: 0, //0，折扣，1领取优惠券
      descList: [{
        title: '详情',
        index: 0,
      }],
      collageInfo: null,
      isFromCollage: false,
      collagePrice: 0,
      collageOriginalPrice: 0,
      showCollageStock: 0, //每人拼团限购数量
      collagePlayerPrice: 0, //团员价
      isPlayer: false, //是否以团员身份购买
      joinGroupId: '', //要加入的团的ID
      groupId: '',
      showHideOnBlur: false,
      collageList: [],
      is_collagePage: false,
      collagePage: 1,
      limit: 10,
      defaltSpec: [0, 0], //最低价格标识
      isChangeSelectType: false, //判断商品属性是否改变
      selectTypeImg: '', //当前规格图片
      isMallExpressDeliver: 0, //是否物流配送 1支持 -1不支持
      isMallOfflineDeliver: 0, //是否线下自提 1支持 -1不支持
      isSalesBegin: false, // 判断限时购正在进行
      shopTopComment: null, // 商品评论
      commentsTotal: 0, //商品评论条数
      vipType: '', // 用户身份类型
      minOrderQuantity: 1, //起售件数
      agentDisc: {}, // 代理商折扣
      agentName: {}, //代理商名称
      commonProdInfo: null, // 代理商折扣信息
      cashBack: null, // 商城满减活动
      buyerSwiperList: [],
      enableBuyedInfoSwiper: JSON.parse(localStorage.getItem("cfg")).enableBuyedInfoSwiper ? JSON.parse(localStorage.getItem("cfg")).enableBuyedInfoSwiper : 0,
      currentVideoObj: {},
      isAssociatedForm: false,
      isShowFormlg: localStorage.getItem("showForm") == 1 ? true : false,
      collectPage: 1,
      isRelForm: false,
      hasFormLog: false,
      enableEdit: 1,
      isHideDiscountInfo: -1, // 是否隐藏折扣信息
      relData: [], // 商品关联售卖列表
      showRelData: false, // 是否展示关联售卖弹窗
      bargain: null, // 商城砍价
      bargainType: "BUY", // 砍价用来区分规格弹窗确认按钮是立即购买(BUY)/砍价享(BARGAIN)
      showAccountQcode: false,
      mpQrcode: '', // 二维码图片链接
      bindPhoneSetting: null,
      ckFrom: global.ckFrom,
      guideData: null, // 入群引导
      presale: null, // 商品预售信息
      currentSpecDeposit: 0, //  当前规格预售定金
      currentSpecInfo: null, // 当前规格预售信息
      enableChainModel: false,
      specItemInfos: [],
      chainInfo: '',
      isChainProd: false,
      selectTypeInfoTxt: '', // 规格已选择文案
      cfrom: global.ckFrom,
      shareSetting: null, // 分享信息
      optimal: null, // 最低价格对象
      currentDiscount: null, //当前身份折扣
      chainPrice: null, // 链动价格
      flashPrice: '', // 当前限时折扣价格
    };
  },
  created() {
    utilJs.appShare(this);
    let that = this;
    this.swiperOption = {
      pagination: {
        el: '.swiper-pagination',
        bulletActiveClass: 'theme-bg',
        type: "custom"
      },
      loop: true,
      speed: 300,
      autoplay: {
        delay: 3000,
        disableOnInteraction: false,
      },
      autoHeight: true,
      updateOnImagesReady: true,
      observer: true,
      on: {
        click: function (event) {
          that.clickSwiperImg(that.$refs.mySwiper.swiper.realIndex);
        },
        slideChange: function () {
          that.swiperIndex = that.$refs.mySwiper.swiper.realIndex;
        }
      },
    };
  },
  computed: {
    // 获取按钮专享价名称
    getBuyBtnTitle() {
      let isBargain = this.bargain && ((this.bargain.status == 1 && this.bargain.isPreheat == 1) || this.bargain.status == 2);
      let dialogPrice = this.dialogPrice || this.shopInfo.price;
      let hasChain = this.chainPrice != this.shopInfo.price;
      let hasDiscount = false;
      if (
          ( // 身份折扣
            this.shopInfo.vipDiscountType == 1 && (
              (this.vipType == 2 && this.shopInfo.vipDiscount < 100) ||
              (this.vipType == 4 && this.shopInfo.svipDiscount < 100) ||
              ((this.vipType == 3 || this.vipType > 4) && this.commonProdInfo && this.commonProdInfo.agentDiscount < 100)
            )
          ) ||
          ( //
            this.shopInfo.vipDiscountType == 2 && (
            (this.vipType == 2 && (this.shopInfo.vipDiscount * 1 < dialogPrice * 1)) ||
            (this.vipType == 4 && (this.shopInfo.svipDiscount * 1 < dialogPrice * 1)) ||
            ((this.vipType == 3 || this.vipType > 4) && this.commonProdInfo && (this.commonProdInfo.agentDiscount * 1 < dialogPrice * 1))
            )
          )
        ) {
        hasDiscount = true;
      }
      if (this.optimal) {
        return (this.optimal.optimalPriceType == 1 || (isBargain && this.optimal.optimalPriceType == 112) || (this.isInCollage && this.optimal.optimalPriceType == 102) ? (hasDiscount || hasChain ? '单买专享价' : '单买价') : '单买专享价')
      } return '立即购买'
    },
    showMarketingBar() {
      return this.shopInfo &&
        (
          !!this.presale ||
          this.flashSales ||
          (this.collageInfo && (this.collageInfo.status == 2 || this.collageInfo.status == 1)) ||
          this.shopInfo.isFriendHelper ||
          (this.bargain && ((this.bargain.status == 1 && this.bargain.isPreheat == 1) || this.bargain.status == 2))
        )
    },
    // 获取尾款支付日期如下： 3月28日 9:30-3月31日9:30
    getLeaveTime() {
      return function(type) {
        if (this.presale == null) return
        let depositStartTime = new Date(this.presale.depositStartTime.replace(/-/g, "/"));
        let depositEndTime = new Date(this.presale.depositEndTime.replace(/-/g, "/"));
        if (type && type == 1) {
          return `${depositEndTime.getMonth() + 1}月${depositEndTime.getDate()}日 ${depositEndTime.getHours() > 9 ? '' + depositEndTime.getHours() : '0' + depositEndTime.getHours()}:${depositEndTime.getMinutes() > 9 ? '' + depositEndTime.getMinutes() : '0' + depositEndTime.getMinutes()}`
        } else {
          return `${depositStartTime.getMonth() + 1}月${depositStartTime.getDate()}日 ${depositStartTime.getHours() > 9 ? '' + depositStartTime.getHours() : '0' + depositStartTime.getHours()}:${depositStartTime.getMinutes() > 9 ? '' + depositStartTime.getMinutes() : '0' + depositStartTime.getMinutes()} - ${depositEndTime.getMonth() + 1}月${depositEndTime.getDate()}日 ${depositEndTime.getHours() > 9 ? '' + depositEndTime.getHours() : '0' + depositEndTime.getHours()}:${depositEndTime.getMinutes() > 9 ? '' + depositEndTime.getMinutes() : '0' + depositEndTime.getMinutes()}`
        }
      }
    },
    // 展示规格
    showSpecificationsArea() {
      // isAssignUser=1用户限购可购买，isAssignUser=0用户限购无法购买 && 预售限购超过
      let showFlag = (this.shopInfo && this.shopInfo.specificationEnabled == 1 && this.specItems && this.specItems.length > 0 &&
        ((this.shopInfo.limitType == -1 && this.dialogStock > 0) || (this.shopInfo.limitType != -1 && this.shopInfo.isAssignUser == 1 && this.dialogStock > 0) || (this.shopInfo.limitType != -1 && this.shopInfo.isReachedLimit == 1 && this.shopInfo.isAssignUser == 0 && this.dialogStock > 0))) &&
        (this.presale == null || (this.presale && this.presale.limit > 0 && (this.presale.limit - this.presale.buyCount > 0)))
      return showFlag;
    },
    // 商品数量添加的最大值限制
    shopNumberMax() {
      let max = (this.flashSales && this.flashSales.sales.status == 2) ? (this.flashSales.sales.limit != 0 ? this.showSalesStock * 1 : this.dialogStock * 1)
        : (this.collageInfo && this.isFromCollage ? (this.collageInfo.isLimit == 1 ? this.showCollageStock * 1 : this.dialogStock * 1)
          : (this.shopInfo.limitType != -1 ? (this.shopInfo.limitNumber - this.shopInfo.purchasedNum) : this.dialogStock * 1))
      return max
    },
    //是否是营销活动且选择的购买方式是营销购买
    isMarketing() {
      let isMarketing = (this.presale || this.isInFlashSales || this.isInCollage || this.bargainType == "BARGAIN") ? true : false
      return isMarketing
    },
    isShowGetCoupon() {
      let isShow = this.companyAuth && this.companyAuth.enableRedeemCode == 1 && this.couponList.length > 0;
      return isShow;
    },
  },
  methods: {
    jumpToAnchor(event) {
      event.preventDefault(); // 阻止默认的链接跳转行为
      document.getElementById('goodParams').scrollIntoView({ behavior: 'smooth', block: 'start' }); // 平滑滚动到目标锚点
    },
    handleShowGuidePop() {
      // 显示入群引导
      this.$refs.guidance.isShowPop();
    },
    clickShowRelData() {
      this.showRelData = !this.showRelData;
    },
    //检查是否正在拼团中
    checkIsInCollage() {
      if (!this.collageInfo || this.companyAuth.enableCollage != 1) {
        return false;
      }
      let nt = new Date().getTime();
      let st = utilJs.getTimeByDate(this.collageInfo.startTime);
      let et = utilJs.getTimeByDate(this.collageInfo.endTime);
      //当前时间在开始时间和结束时间之间并且拼团状态>-1
      if (nt >= st && nt < et && this.collageInfo.status > -1) {
        return true;
      }
      if (nt < st && this.collageInfo.status == 1) {
        return true;
      }
      return false;
    },
    //检查是否开启限时购
    checkIsInFlashSales() {
      if (!this.flashSales || this.companyAuth.enableFlashSalesModule != 1) {
        return false;
      }
      if (!this.flashSales.sales) {
        return;
      }
      let nt = (new Date()).getTime();
      let st = utilJs.getTimeByDate(this.flashSales.sales.startTime);
      let et = utilJs.getTimeByDate(this.flashSales.sales.endTime);
      if (nt >= st && nt < et && this.flashSales.sales.status > -1) {
        return true;
      }
      return false;
    },
    initSpecData(type) {
       const MAX_BUY_TYPE_MAP = {
        '1': '每天',
        '2': '每周',
        '3': '每月',
        '4': '每季度',
        '5': '每半年',
        '6': '每年',
        '7': '每次'
      };
      let collagePeopleNum = this.isInCollage ? this.collageInfo.peopleNum : 0;
      let defaultCover = this.shopInfo.avatar ? this.shopInfo.avatar : (this.swiperList.length > 0 ? this.swiperList[0].url : '');
      let isInCollage = this.isFromCollage; // 判断是不是拼团规格半弹窗
      let defaultPrice = this.shopInfo.price;
      let collagePrice = this.isInCollage ? this.collageInfo.captainPrice : 0;
      let defaultOriginalPrice = this.shopInfo.originalPrice * 1 > 0 ? this.shopInfo.originalPrice : this.shopInfo.price;
      let defaultStock = this.dialogStock;
      let flashSalesStock = this.isInFlashSales ? this.flashSales.limit : 0;
      let collageStock = this.isInCollage && this.collageInfo.status == 2 && this.collageInfo.isLimit == 1 ? this.collageInfo.limitCount : 0;
      let marketMaxBuyNum = this.presale && this.presale.limit > 0 ? (this.presale.limit - this.presale.buyCount * 1) : flashSalesStock || collageStock || 0;
      let minBuyNum = this.shopInfo.minOrderQuantity || 1;
      let maxDefaultInputNum = this.shopInfo.limitType != -1 ? (this.shopInfo.limitNumber - this.shopInfo.purchasedNum) : 0;
      maxDefaultInputNum = marketMaxBuyNum || maxDefaultInputNum || 0;
      let maxBuyNum = !this.presale && !this.isInCollage && !this.isInFlashSales && this.shopInfo.limitType != -1 ? this.shopInfo.limitNumber : 0;
      let maxBuyNumText = this.shopInfo.limitType == 1 || this.presale ? '' : MAX_BUY_TYPE_MAP[this.shopInfo.limitCycleType];
      maxBuyNumText = maxBuyNum ? `(${maxBuyNumText}限购${maxBuyNum}件)` : '';
      this.currentsp = this.shopInfo.defaltSpec;
      let defaltSpecItem = this.specItemInfos.find(i => i.stock > 0);
      defaltSpecItem = defaltSpecItem ? JSON.parse(defaltSpecItem.itemGroup) : '';
      let specs = this.specs;
      let specItems = this.specItems;
      let specItemInfos = this.specItemInfos;
      let isInFlashSales = this.isInFlashSales;
      let limitInfo = {
        limitType: this.shopInfo.limitType,
        limitNumber: this.shopInfo.limitNumber,
        purchasedNum: this.shopInfo.purchasedNum
      }
      let falshSalesPrice = this.isInFlashSales ? this.flashSales.price : 0;
      let bargain = this.bargain;
      let presale = this.presale
      let currentSpecDeposit = this.currentSpecDeposit;
      let showPriceBar = this.vipType != 1;
      let specInfo = {
        isInCollage,
        isInFlashSales,
        collagePeopleNum,
        defaultCover,
        defaultPrice,
        collagePrice,
        falshSalesPrice,
        defaultOriginalPrice,
        defaultStock,
        marketMaxBuyNum,
        minBuyNum,
        maxDefaultInputNum,
        maxBuyNumText,
        specs,
        specItems,
        specItemInfos,
        selectSpec: this.isChangeSelectType == true ? this.selectTypeIndex : (this.defaltSpec || defaltSpecItem),
        bottomBuyType: this.clickButtonType,
        limitInfo,
        currentSpecDeposit,
        presale,
        showPriceBar,
        vipType: this.vipType,
        vipDiscountType: this.shopInfo.vipDiscountType || 1,
        isMarketing: this.isMarketing ? true : false,
        optimal: this.optimal,
        vipDiscount: this.shopInfo.vipDiscount,
        svipDiscount: this.shopInfo.svipDiscount,
        commonProdInfo: this.commonProdInfo,
        chainInfo: this.chainInfo,
        mgId: this.shopInfo.mgId
      }
      // 预售
      if (this.presale) {
        specInfo.defaultPrice = this.showPrice;
      }
      // 砍价判断
      if (this.bargainType == "BARGAIN") {
        specInfo.bargain = bargain;
        specInfo.bargainType = this.bargainType;
        specInfo.defaultPrice = Number(this.bargain.reservePrice).toFixed(2);
      }
      if (this.isChangeSelectType == false) {
        this.showSpecifications = true;
      }
      // 多规格默认选中商品规格
      if (!type) {
        this.$nextTick(() => {
          this.$refs.shopSpec.public_initSpecInfo(specInfo);
        })
      }
    },
    //购买信息
    buyedInfoSwiper() {
      let that = this
      utilJs.getMethod(`${global.apiurl}common/buyedInfoSwiper?prodId=${that.ShopId}&prodType=${global.ckFrom.shopping}`, function (res) {
        that.buyerSwiperList = res
      }, failRes => {
      });
    },
    // 跳转到活动页面
    gocashBackAct(id) {
      this.$routerGo(this, "push", {
        path: "/mall/cashBackActivity/cashBackActivity",
        query: { mcbId: id }
      });
    },
    // 点击图片放大预览
    clickPreviewImage(index, imgUrl, imgs) {
      if (!imgUrl) {
        return;
      }
      let imgArr = [];
      for (let key of imgs) {
        imgArr.push(key);
      }
      wxUtilJs.previewImage({
        current: imgUrl, // 当前显示图片的http链接
        urls: imgArr // 需要预览的图片http链接列表
      });
    },
    goGroup(groupId) {
      this.isPlayer = true;
      this.joinGroupId = groupId;
      this.clickBuyNow('fromCollage')
    },
    timeFn: function () {
      let etime = this.groupInfo.endTime ? utilJs.getTimeByDate(this.groupInfo.endTime) : 0;
      let nowTime = (new Date()).getTime();
      //限时购 sales.status 1未开始,2进行中,-1已结束
      //拼团 .status 1未开始,2进行中,3已结束,4已停止
      //好友助力 .faStatus 1未开始,2进行中,-1已结束
      let time = '';
      if (etime > nowTime) {
        this.groupInfo.status = 2;
        time = this.groupInfo.endTime;
      } else {
        this.groupInfo.status = 3;
      }
      return time;
    },
    finishFn() {
      if (this.groupInfo.status == 2) {
        this.groupInfo.status = 3;
      }
    },
    getMoreCollage(collageId, isMore) {
      if (isMore == 0) {
        if (this.collageList.length > 0) {
          return;
        } else {
          this.collageList = [];
          this.collagePage = 1;
          this.is_collagePage = false;
        }
      }
      let $this = this;
      utilJs.getMethod(global.apiurl + 'mallCollage/getMoreGroup?limit=' + this.limit + '&page=' + this.collagePage + "&collageId=" + collageId, function (res) {
        if ($this.collagePage == 1) {
          $this.collageList = res.data;
        } else {
          let list = res.data;
          $this.collageList = $this.collageList.concat(list);
        }
        $this.collagePage = res.data && (res.data.length >= $this.limit) ? ($this.collagePage + 1) : $this.collagePage;//res.current_page < res.last_page ? ($this.collagePage + 1) : $this.collagePage;
        $this.is_collagePage = res.data && (res.data.length >= $this.limit) ? true : false;//res.current_page < res.last_page;
      });
    },
    gcd: function (cinfo) {
      this.goCollageDetail(cinfo.groupId, cinfo.collageId);
    },
    //跳转到拼团详情页
    goCollageDetail: function (groupId, collageId) {
      if (this.collageInfo.userType && this.collageInfo.userType != -1 && this.collageInfo.groupId != groupId) {
        this.$showCjToast({
          text: '您已在拼团中，不需要再去拼单啦！',
          type: 'warn'
        });
      } else {
        if (this.collageInfo.status == 1) {
          this.$showCjToast({
            text: '活动未开始，暂不能拼团！',
            type: 'warn'
          });
        } else {
          let pathQuery = {
            'groupId': groupId,
            'collageId': collageId,
            ckFrom: global.ckFrom.mall,
            recRelateId: this.$route.query.recRelateId,
            recType: this.$route.query.recType,
            isMall: 1
          };
          if (this.goodsRoomId) {
            pathQuery.goodsRoomId = this.goodsRoomId;
          }
          this.$routerGo(this, "push", {
            path: "/homePage/collageInfo/collageDetail",
            query: pathQuery
          });
        }
      }
    },
    closeModal() {
      this.showCoupon = false;
    },
    //获取可以领取的优惠券
    getCouponList: function () {
      if (!this.couponLoading) {
        this.couponLoading = true;
        let $this = this;
        utilJs.getMethod(global.apiurl + 'redeemCodes/getCouponsByRedeemType?courseId=' + this.ShopId + '&redeemType=107&limit=10&page=' + this.couponPage, function (res) {
          $this.couponLoading = false;
          $this.couponList = $this.couponList.concat(res.data);
          $this.couponPage = res.next_page_url ? ($this.couponPage + 1) : $this.couponPage;
          $this.couponIsPage = res.next_page_url ? true : false;
        },
          failRes => {
            $this.couponLoading = false;
          }
        );
      }
    },
    // // 限时购倒计时
    falshSalesTime(status) {
      if (this.flashSales) {
        this.flashSales.sales.status = status;
      } else if (this.collageInfo) {
        this.collageInfo.status = status;
      } else if (this.bargain) {
        this.bargain.status = status
      }
    },
    // // 限时购倒计时结束
    finishFlashSales(status) {
      if (this.flashSales) {
        this.flashSales.sales.status = status;
      } else if (this.collageInfo) {
        this.collageInfo.status = status;
        if (status != 1 && status != 2) {
          this.collageInfo = null;
        }
      } else if (this.bargain) {
        this.getShopInfo();
      }
    },
    //点击轮播图
    clickSwiperImg(index) {
      if (this.videoInfo != null && index == 0) {
        this.showVideo = true;
      } else {
        let arr = [];
        this.swiperList.forEach(item => {
          arr.push(item.url)
        })
        this.clickPreviewImage(index, this.swiperList[index].url, arr);
      }
    },
    //点击关闭视频
    clickCloseVideo() {
      if (this.showVideo) {
        this.showVideo = false;
      }
    },

    closeSpecModal(info) {
      this.isPlayer = false;
      this.joinGroupId = "";
      this.getShopSpecInfo(info);
      this.initSelectTypeInfo();
      this.showSpecifications = false;
    },
    //点击显示弹窗规格
    checkDefaultSpec() {
      if ((this.specItems && this.specItems.length > 0 && this.shopInfo.stock == null) || this.dialogStock > 0) {
        if (this.collageInfo) {
          this.isFromCollage = true;
        }
        this.showSpecifications = true;
        this.clickButtonType = this.presale ? "BUY" : this.bargain ? "BARGAINSPEC" : "SPEC";
        this.initSpecData(); // 初始化购物车数据
        this.initSelectTypeInfo();
      }
    },
    clickShare(type) {
      if (this.bindPhoneSetting && this.bindPhoneSetting.shareBind) {
        if (utilJs.goBindMobile()) return;
      }
      if (type == 'activity') {
        let type = this.collageInfo && this.collageInfo.status == 2 ? 3 : this.flashSales && this.flashSales.sales && this.flashSales.sales.status == 2 ? 2 : 5;
        let cId = this.bargain ? this.bargain.bargainId : this.flashSales ? this.flashSales.pId : this.collageInfo ? this.collageInfo.collageId : '';
        this.$routerGo(this, "push", { path: '/homePage/spread/spreadPoster', query: { cId: cId, type: type, ckFrom: global.ckFrom.shopping, proId: this.shopInfo.mgId } });
        return
      }
      if (this.shopInfo.isInvitionCard == 1) {
        this.$routerGo(this, "push", {
          path: "/homePage/spread/spreadCustom",
          query: {
            ckFrom: global.ckFrom.shopping,
            cId: 0,
            extId: this.ShopId
          }
        })
      } else {
        //点击分享
        this.isShowShare = true;
      }
    },
    getShopSpecInfo(info) {
      this.selectTypeIndex = info.selectSpec;
      this.selectShopNum = info.selectShopNum;
      if (info.isChangeSelectType) {
        this.isChangeSelectType = info.isChangeSelectType;
        this.initSpecInfo();
      }
    },
    clickCart(e) {
      //点击购物车
      this.$routerGo(this, "push", { path: "/mall/shopCart/shopCart" });
    },
    hideDialog() {
      this.showAccountQcode = false;
    },
    //点击加入购物车
    clickJoinCart() {
      if (this.enableChainModel) {
        this.$showCjToast({
          text: '该链动商品不支持加入购物车',
          type: "warn",
          time: 1500
        });
        return;
      }
      if (this.bindPhoneSetting && this.bindPhoneSetting.getBind) {
        if (utilJs.goBindMobile()) return;
      }
      if (this.isAssociatedForm) {
        this.goForm(2);
        return
      }
      let that = this;
      that.showLimitPurchase().then(() => {
        that.isFromCollage = false;
        that.clickButtonType = "CAR";
        that.showSpecifications = true;
        that.initSpecData(); // 初始化购物车数据
      }).catch(() => {
        return
      })
    },
    // 拼团 + 原价限购处理
    showLimitPurchase() {
      let that = this;
      return new Promise(function (resolve, reject) {
        if (!(that.shopInfo.limitType != -1 && that.collageInfo != null && that.isFromCollage == false)) {
          resolve();
          return;
        }
        if ((that.shopInfo.limitNumber <= that.shopInfo.purchasedNum) && (that.shopInfo.purchasedNum > 0)) {
          that.$showCjToast({
            text: '您已购买过该商品，当前不能购买更多了',
            type: "warn",
            time: 1500
          });
          reject();
        } else if ((that.shopInfo.limitNumber <= that.shopInfo.purchasedNum) && (that.shopInfo.purchasedNum == 0)) {
          that.$showCjToast({
            text: '当前不能购买更多了',
            type: "warn",
            time: 1500
          });
          reject();
        } else {
          resolve()
        }
      })
    },
    checkUserIsFollowedMp(bargainId) {
      return new Promise(function (resolve, reject) {
        utilJs.getMethod(`${global.apiurl}bargains/getMpData?bargainId=${bargainId}`,
          res => {
            resolve(res);
          },
          failRes => {
            reject(failRes)
          }
        )
      })
    },
    // 点击砍价享按钮
    clickBargainBuy(info) {
      if (this.bindPhoneSetting && this.bindPhoneSetting.buyBind) {
        if (utilJs.goBindMobile()) return;
      }
      if (this.bargain && this.bargain.status == 1 && this.bargain.isPreheat == 1) {
        this.$showCjToast({
          text: '活动未开始，暂不能砍价！',
          type: 'text'
        });
        return;
      }
      if ((this.selectShopNum > this.bargain.stock) && this.bargain.isLimitStock == 1 && this.bargain.userType != 1) {
        this.$showCjToast({
          text: '购买该活动的商品数不能大于参与砍价活动的商品数',
          type: 'text'
        });
        return;
      }
      if (this.selectTypeInfo || info || this.bargain.userType == 1) {
        if (info) this.getShopSpecInfo(info);
        this.handleClickBargainDetail();
        return
      } else {
        this.clickButtonType = "BUY";
        this.bargainType = "BARGAIN"
        this.initSpecData(); // 初始化购物车数据
      }
    },
    // 砍价跳转
    handleClickBargainDetail(info) {
      this.checkUserIsFollowedMp(this.bargain.bargainId).then(res => {
        if (res.threshold == 2 && res.isFollowedMp == 0) {
          this.mpQrcode = res.mpQrcode;
          this.showAccountQcode = true;
          return;
        }
        // 有关联表单，则跳到报名表单处
        if (this.isAssociatedForm) {
          this.goForm();
          return
        } else {
          if (this.bargain.status == 2) {
            let query = {
              bargainId: this.bargain.bargainId,
              gsiiId: this.dialogGsiiId,
              number: this.selectShopNum
            }
            if (this.bargain && this.bargain.attendId) {
              query.attendId = this.bargain.attendId
            }
            this.$routerGo(this, "push", {
              path: "/homePage/bargain/bargainDetail",
              query: query
            });
          }
        }
      })
    },
    //点击立即购买
    clickBuyNow(fromType) {
      // 有入群引导信息&&开启入群引导&&主动弹窗，等购买回来，购买后自动弹出一次
      if (this.guideData && this.guideData.isOpenGuide == 1 && this.guideData.guideType.includes(3)) {
        localStorage.setItem(`showGuideId`, shopNo)
      }
      if (this.bindPhoneSetting && this.bindPhoneSetting.buyBind) {
        if (utilJs.goBindMobile()) return;
      }
      // this.selectTypeIndex = this.defaltSpec;
      this.isFromCollage = fromType == 'fromCollage' ? true : false;
      this.isInCollage = fromType == 'fromCollage' ? true : false;
      this.bargainType = "BUY";
      if (this.isFromCollage && this.collageInfo.status == 1) {
        this.$showCjToast({
          text: "活动未开始，暂不能拼团！",
          type: "warn",
          time: 1500
        });
        return;
      }
      if (this.isAssociatedForm) {
        this.goForm(1);
        return
      }
      let that = this;
      that.showLimitPurchase().then(() => {
        that.showSpecifications = true;
        that.clickButtonType = fromType == 'cart' ? "SPEC" : "BUY";
        that.initSpecData(); // 初始化购物车数据
        // if (that.selectTypeInfo) {
        //   that.gotoSettlement();
        // } else {
        //   that.clickButtonType = "BUY";
        //   that.initSpecData(); // 初始化购物车数据
        // }
      }).catch(() => {
        return
      })
    },
    goForm(specsType) {
      let pathQuery = {
        cId: -1,
        extId: this.shopInfo.mgId,
        ckFrom: global.ckFrom.shopping,
        isFromInvite: 0,
        pId: this.flashSales && this.flashSales.sales.status == 2 ? this.flashSales.pId : '',
        relType: 19,
        type: 1,
        recRelateId: this.$route.query.recRelateId,
        recType: this.$route.query.recType,
        isGoBack: 1,
      };
      if (this.goodsRoomId) {
        pathQuery.goodsRoomId = this.goodsRoomId;
      }
      if (specsType) {
        pathQuery.specsType = specsType;
      }
      this.$routerGo(this, "push", { path: '/homePage/form', query: pathQuery }); //type==1表示关联表单
    },
    //跳到结算页面
    gotoSettlement() {
      if (this.dialogStock * 1 < this.selectShopNum) {
        this.$showCjToast({
          text: "库存不足",
          type: "warn",
          time: 1500
        });
        return;
      }
      if (this.flashSales && this.flashSales.sales.status == 2 && this.flashSales.limit != 0 && this.optimal && this.optimal.optimalPriceType == 101) {
        if (this.showSalesStock < this.selectShopNum) {
          this.$showCjToast({
            text: "每人仅限购" + this.flashSales.limit + "件",
            type: "warn",
            time: 1500
          });
          return;
        }
      }
      if (this.collageInfo && this.collageInfo.status == 2 && this.collageInfo.isLimit == 1 && this.isFromCollage) {
        if (this.showCollageStock < this.selectShopNum) {
          this.$showCjToast({
            text: "每人仅限购" + this.collageInfo.limitCount + "件",
            type: "warn",
            time: 1500
          });
          return;
        }
      }
      // 多规格商品根据不同的商品传不同的定金活动价格
      if (this.presale && this.specItems && this.specItems.length > 0) {
        this.presale.aPrice = this.showPrice;
        this.presale.deposit = this.currentSpecDeposit;
      }
      let shopInfo = [
        {
          mgId: this.shopInfo.mgId,
          mcId: "",
          minOrderQuantity: this.minOrderQuantity,
          avatar: this.selectTypeImg,
          pointsDeduct: this.shopInfo.pointsDeduct,
          name: this.shopInfo.name,
          price: this.dialogPrice || this.shopInfo.price,
          originalPrice: this.dialogOriginalPrice ? this.dialogOriginalPrice : this.shopInfo.originalPrice,
          quantity: this.selectShopNum,
          shopSpecInfo: this.selectTypeInfo,
          gsiiId: this.dialogGsiiId,
          postage: this.shopInfo.postage,
          isMail: this.shopInfo.isMail,
          stock: this.dialogStock,
          freeShipping: this.freeShipping,
          vipDiscount: this.shopInfo.vipDiscount,
          svipDiscount: this.shopInfo.svipDiscount,
          commonProdInfo: this.shopInfo.commonProdInfo,
          vipDiscountType: this.shopInfo.vipDiscountType || 1,
          isMallExpressDeliver: this.isMallExpressDeliver,
          isMallOfflineDeliver: this.isMallOfflineDeliver,
          givenPoints: this.shopInfo.givenPoints && this.shopInfo.givenPoints > 0 ? this.shopInfo.givenPoints : 0,
          limitType: this.shopInfo.limitType,
          limitNumber: this.shopInfo.limitNumber,
          purchasedNum: this.shopInfo.purchasedNum ? this.shopInfo.purchasedNum : 0,
          relData: this.relData && this.relData.length > 0 ? this.relData : []
        }
      ];
      // 预售
      if (this.presale) {
        shopInfo[0].price = this.presale.aPrice;
        shopInfo[0].presale = this.presale;
        shopInfo[0].moneyType = 2; // 预售定金购买流程
        shopInfo[0].stock = this.presale && this.presale.limit > 0 ? ((this.presale.limit - this.presale.buyCount) > this.dialogStock ? this.dialogStock : (this.presale.limit - this.presale.buyCount)) : this.dialogStock;
        shopInfo[0].quantity = this.selectShopNum;
      }
      // 拼团
      if (this.collageInfo && this.collageInfo.status == 2 && this.isFromCollage) {
        shopInfo[0].collageStock = this.collageInfo.limitCount;
        shopInfo[0].price = this.isPlayer ? this.collagePlayerPrice : this.collagePrice;
        shopInfo[0].originalPrice = this.collageOriginalPrice;
        shopInfo[0].isCollage = true;
        shopInfo[0].groupId = this.joinGroupId ? this.joinGroupId : -1;
        shopInfo[0].mallCollageId = this.collageInfo.collageId;
        if (this.collageInfo.isLimit == 1 && this.showCollageStock * 1 > 0) {
          shopInfo[0].collageLimit = this.showCollageStock * 1;
        }
        if (this.collageInfo.isLimit != 1) {
          shopInfo[0].noLimit = true;
        } else if (this.collageInfo.isLimit == 1) {
          shopInfo[0].stock = this.showCollageStock;
        }
      }
      // 限时折扣
      if (this.flashSales && this.flashSales.sales.status == 2 && this.optimal && this.optimal.optimalPriceType == 101) {
        shopInfo[0].salesStock = this.flashSales.limit;
        shopInfo[0].noLimit = this.flashSales.limit == 0;
        shopInfo[0].pointsDeduct = 0; // 限时购不能使用积分
        shopInfo[0].isFlashSales = true;
        shopInfo[0].pId = this.flashSales.pId;
        shopInfo[0].originalPrice = this.showOriginalPrice;
        shopInfo[0].price = this.flashPrice;
        if (this.flashSales.limit != 0) {
          shopInfo[0].salesLimt = this.showSalesStock * 1 > 0 ? this.showSalesStock * 1 : 0;
          shopInfo[0].stock = this.showSalesStock;
        }
      }
      if (isFromInteract) {
        shopInfo[0].isFromInteract = true;
        shopInfo[0].interactDetailId = Number(this.$route.query.interactDetailId);
      }
      let discountPrice = shopInfo[0].price;
      // 计算身份证折扣价格
      if (this.vipType != 1) {
        if (this.shopInfo.vipDiscountType == 1) {
          discountPrice =
            this.vipType == 2 ?
            Number(shopInfo[0].price * shopInfo[0].vipDiscount / 100).toFixed(2) :
            this.vipType == 4 ?
            Number(shopInfo[0].price * shopInfo[0].svipDiscount / 100).toFixed(2) :
            Number(shopInfo[0].price * shopInfo[0].commonProdInfo.agentDiscount / 100).toFixed(2);
        } else {
          discountPrice = this.vipType == 2 ? Number(shopInfo[0].vipDiscount).toFixed(2) : this.vipType == 4 ? Number(shopInfo[0].svipDiscount).toFixed(2) : Number(shopInfo[0].commonProdInfo.agentDiscount).toFixed(2);
        }
      }
      // 链动最优价格 || 链动价格小于等于折扣价格
      if (!(this.isInCollage && this.bargainType == "BARGAIN") && ((this.chainInfo && this.chainInfo.isChainProd && this.optimal && [10, 20, 99].includes(this.optimal.optimalPriceType)) || (this.chainPrice <= discountPrice))) {
        if (this.chainInfo && (this.chainInfo.enableOrderDiscount == 1 && this.chainInfo.orderBonus > 0)
        || (this.chainInfo && this.chainInfo.isReorder && this.chainInfo.enableReorderDiscount == 1 && this.chainInfo.reorderBonus > 0)) {
          shopInfo[0].isReorder = this.chainInfo.enableReorderDiscount == 1 && this.chainInfo.isReorder && this.chainInfo.reorderBonus > 0 ? true : false;
          shopInfo[0].orderBonus = this.chainInfo.enableReorderDiscount == 1 && this.chainInfo.isReorder && this.chainInfo.reorderBonus > 0 ? this.chainInfo.reorderBonus : this.chainInfo.enableOrderDiscount == 1 ? this.chainInfo.orderBonus : 0;
          shopInfo[0].isFromChain = true;
        }
      }
      if (this.shopInfo.valuationMethod && this.shopInfo.valuationMethod == 2 && this.shopInfo.freightMode == 1) {
        shopInfo[0].valuationMethod = 2;
      }
      if (this.cashBack != null && (this.cashBack && this.cashBack.length != 0)) {
        this.$set(this.cashBack, 'products', shopInfo);
        sessionStorage.setItem("shopBuyInfo", JSON.stringify([this.cashBack]));
      } else {
        sessionStorage.setItem("shopBuyInfo", JSON.stringify(shopInfo));
      }
      let goPath = "/mall/shopSettlement/shopSettlement?shopNo=" + shopNo;
      if (this.goodsRoomId) {
        goPath = `${goPath}&goodsRoomId=${this.goodsRoomId}`;
      }
      this.$routerGo(this, "push", {
        path: goPath
      });
    },
    //点击弹窗的加入购物车
    clickDialogJoinCart(info) {
      if (this.bindPhoneSetting && this.bindPhoneSetting.getBind) {
        if (utilJs.goBindMobile()) return;
      }
      this.getShopSpecInfo(info);
      this.initSelectTypeInfo();
      setTimeout(() => {
        this.joinCart();
      }, 300)
      this.showSpecifications = false;
    },
    //点击弹窗的购买
    clickDialogBuy(info) {
      if (this.bindPhoneSetting && this.bindPhoneSetting.buyBind) {
        if (utilJs.goBindMobile()) return;
      }
      if (this.isFromCollage && this.collageInfo.status == 1) {
        this.$showCjToast({
          text: "活动未开始，暂不能拼团！",
          type: "warn",
          time: 1500
        });
        return;
      }
      this.getShopSpecInfo(info);
      this.initSelectTypeInfo();
      this.showSpecifications = false;
      setTimeout(() => {
        this.gotoSettlement();
      }, 300)
    },
    //点击选择规格弹窗的确认
    clickConfirmJoinCar(info) {
      if (this.bindPhoneSetting && this.bindPhoneSetting.buyBind) {
        if (utilJs.goBindMobile()) return;
      }
      this.getShopSpecInfo(info);
      this.initSelectTypeInfo();
      this.showSpecifications = false;
      setTimeout(() => {
        if (this.clickButtonType == "CAR") {
          this.joinCart();
        } else if (this.clickButtonType == "BUY") {
          if (info.bargainType == "BARGAIN") {
            this.handleClickBargainDetail()
          } else {
            this.gotoSettlement();
          }
        }
      }, 500)
    },
    //加入购物车
    joinCart() {
      if (this.enableChainModel) {
        this.$showCjToast({
          text: '该链动商品不支持加入购物车',
          type: "warn",
          time: 1500
        });
        return;
      }
      if (this.dialogStock * 1 < this.selectShopNum) {
        this.$showCjToast({
          text: "库存不足",
          type: "warn",
          time: 1500
        });
        return;
      }
      if (this.flashSales && this.flashSales.sales.status == 2 && this.flashSales.limit != 0) {
        if (this.showSalesStock < this.selectShopNum) {
          this.$showCjToast({
            text: "每人仅限购" + this.flashSales.limit + "件",
            type: "warn",
            time: 1500
          });
          return;
        }
      }
      utilJs.postMethod(
        global.apiurl + "goods/addToCart",
        {
          mgId: shopNo,
          quantity: this.selectShopNum || 1,
          gsiiId: this.dialogGsiiId ? this.dialogGsiiId : null,
          price: this.dialogPrice != '' ? this.dialogPrice : this.showPrice
        },
        res => {
          this.$showCjToast({
            text: "加入购物车成功",
            type: "success",
            time: 1500
          });
          this.cartNum = res;
        }
      );
    },
    // 获取商品对应规格的最优价格
    getSpecOptimalPrice(gsiiId) {
      return new Promise((resolve, reject) => {
        utilJs.getMethod(
        `${global.apiurl}goods/getSpecOptimalPrice?mgId=${shopNo}&gsiiId=${gsiiId}`,
        res => {
          resolve(res.optimal)
        })
      })
    },
    //初始化选择商品规格结果
    async initSpecInfo() {
      this.shopInfo.isInMarketTwoPrice = false;
      let selectGroup = this.isChangeSelectType == true ? "[" + this.selectTypeIndex + "]" : "[" + this.defaltSpec + "]";
      let selectGroupArr = this.specItemInfos.filter(item => {
        return item.itemGroup == selectGroup;
      });
      if (selectGroupArr.length > 0) {
        // 获取规格的最优价格
        if (!selectGroupArr[0].optimal) {
          selectGroupArr[0].optimal = await this.getSpecOptimalPrice(selectGroupArr[0].gsiiId);
          this.optimal = selectGroupArr[0].optimal;
          this.$set(this.shopInfo, "optimal", this.optimal)
          this.specItemInfos.forEach(item => {
            if (item.gsiiId == selectGroupArr[0].gsiiId) {
              item.optimal = selectGroupArr[0].optimal
            }
          })
        }
        let discountPrice = selectGroupArr[0].price;
        discountPrice = this.shopInfo.vipDiscountType == 1 ? Number(selectGroupArr[0].price * 1 * this.currentDiscount / 100).toFixed(2) : Number(this.currentDiscount).toFixed(2);
        this.dialogPrice = this.flashSales && this.flashSales.sales.status == 2 && this.optimal && this.optimal.optimalPriceType == 101 ? selectGroupArr[0].flashPrice : selectGroupArr[0].price;
        this.dialogOriginalPrice = selectGroupArr[0].originalPrice;
        this.dialogStock = selectGroupArr[0].stock;
        this.dialogGsiiId = selectGroupArr[0].gsiiId;
        this.optimal = this.presale ? null : selectGroupArr[0].optimal; // 预售不做价格对象处理
        this.shopInfo.price = selectGroupArr[0].price;
        this.shopInfo.optimal = this.optimal;
        if (this.flashSales && this.optimal && this.optimal.optimalPriceType == 101) {
          if (this.flashSales.sales.status == 2) {
            this.dialogPrice = selectGroupArr[0].flashPrice;
          }
          this.flashPrice = selectGroupArr[0].flashPrice;
          this.showOriginalPrice = selectGroupArr[0].price;
        } else if (this.collageInfo && this.isFromCollage) {
          if (this.collageInfo.status == 2) {
            this.dialogPrice = selectGroupArr[0].captainPrice;
          }
          this.collagePrice = selectGroupArr[0].captainPrice;
          this.collageOriginalPrice = selectGroupArr[0].price;
          this.collagePlayerPrice = selectGroupArr[0].playersPrice;
          this.showPrice = discountPrice;
          this.showOriginalPrice = selectGroupArr[0].originalPrice;
        } else if (this.presale) { // 预售
          this.currentSpecDeposit = selectGroupArr[0].deposit;
          this.currentSpecInfo = selectGroupArr[0];
          this.showPrice = selectGroupArr[0].price;
        } else {
          this.dialogPrice = selectGroupArr[0].price;
          this.showPrice = discountPrice;
          this.showOriginalPrice = selectGroupArr[0].originalPrice;
        }
        if (this.flashSales && this.flashSales.sales.status == 2 && this.flashSales.limit != 0) {
          this.showSalesStock = this.flashSales.limit - this.shopInfo.buyCount;
        }
        if (this.collageInfo && this.collageInfo.status == 2 && this.collageInfo.isLimit == 1) {
          this.showCollageStock = this.collageInfo.buyCount;
        }
      }
      // 判断是否在砍价/拼团/限时折扣中是否需要判断两种价格 一个是活动价格 一个是除了活动外的身份价格
      if (
          (this.bargain && ((this.bargain.status == 1 && this.bargain.isPreheat == 1) || this.bargain.status == 2)) ||
          (this.collageInfo && this.collageInfo.status == 2) ||
          (this.flashSales && this.flashSales.sales && this.flashSales.sales.status == 2 && this.optimal && this.optimal.optimalPriceType != 101)
      ) {
        this.shopInfo.isInMarketTwoPrice = true;
      }
    },
    //初始化选择商品规格结果显示信息
    async initSelectTypeInfo() {
      this.shopInfo.isInMarketTwoPrice = false;
      let selectInfo = "", selectTypeInfoTxt = '';
      for (let i = 0; i < this.selectTypeIndex.length; i++) {
        let selectInfoArr = this.specItems.filter(item => {
          return item.gsiId == this.selectTypeIndex[i];
        });
        if (selectInfoArr.length >= 0) {
          selectInfo += selectInfoArr[0].name + " ";
          selectTypeInfoTxt += selectInfoArr[0].name + (i == this.selectTypeIndex.length - 1 ? " " : "，");
        }
      }
      this.selectTypeInfo = selectInfo;
      this.selectTypeInfoTxt = selectTypeInfoTxt;
      //修改显示的价格为规格价格
      let selectGroup = "[" + this.selectTypeIndex + "]";
      let selectGroupArr = this.specItemInfos.filter(item => {
        return item.itemGroup == selectGroup;
      });
      if (selectGroupArr.length > 0) {
        // 获取规格的最优价格
        if (!selectGroupArr[0].optimal) {
          selectGroupArr[0].optimal = await this.getSpecOptimalPrice(selectGroupArr[0].gsiiId);
          this.specItemInfos.forEach(item => {
            if (item.gsiiId == selectGroupArr[0].gsiiId) {
              item.optimal = selectGroupArr[0].optimal
            }
          })
        }
        this.dialogPrice = this.flashSales && this.flashSales.sales.status == 2 && this.optimal && this.optimal.optimalPriceType == 101 ? selectGroupArr[0].flashPrice : selectGroupArr[0].price;
        this.optimal = selectGroupArr[0].optimal;
        this.shopInfo.price = selectGroupArr[0].price;
        this.shopInfo.optimal = this.optimal;
        let discountPrice = selectGroupArr[0].price;
        discountPrice = this.shopInfo.vipDiscountType == 1 ? Number(selectGroupArr[0].price * 1 * this.currentDiscount / 100).toFixed(2) : Number(this.currentDiscount).toFixed(2);
        if (this.flashSales && this.optimal && this.optimal.optimalPriceType == 101) {
          this.flashPrice = selectGroupArr[0].flashPrice;
          this.showOriginalPrice = selectGroupArr[0].price;
        } else if (this.collageInfo) {
          this.collagePrice = selectGroupArr[0].captainPrice;
          this.collageOriginalPrice = selectGroupArr[0].price;
          this.collagePlayerPrice = selectGroupArr[0].playersPrice;
          this.showPrice = discountPrice;
          this.showOriginalPrice = selectGroupArr[0].originalPrice;
        } else if (this.presale) { // 预售
          this.currentSpecDeposit = selectGroupArr[0].deposit;
          this.currentSpecInfo = selectGroupArr[0];
          this.showPrice = selectGroupArr[0].price;
        } else {
          this.showPrice = discountPrice;
          this.showOriginalPrice = selectGroupArr[0].originalPrice;
        }
        this.selectTypeImg = selectGroupArr[0] && selectGroupArr[0].gsiPicture ? selectGroupArr[0].gsiPicture : (this.shopInfo.avatar ? this.shopInfo.avatar : this.swiperList.length > 0 ? this.swiperList[0].url : '');
        if (this.flashSales && this.flashSales.sales.status == 2 && this.flashSales.limit != 0) {
          this.showSalesStock = this.flashSales.limit - this.shopInfo.buyCount;
        }
        if (this.collageInfo && this.collageInfo.status == 2 && this.collageInfo.isLimit == 1) {
          this.showCollageStock = this.collageInfo.buyCount;
        }
      }
      // 判断是否在砍价/拼团/限时折扣中是否需要判断两种价格 一个是活动价格 一个是除了活动外的身份价格
      if (
          (this.bargain && ((this.bargain.status == 1 && this.bargain.isPreheat == 1) || this.bargain.status == 2)) ||
          (this.collageInfo && this.collageInfo.status == 2) ||
          (this.flashSales && this.flashSales.sales && this.flashSales.sales.status == 2 && this.optimal && this.optimal.optimalPriceType != 101)
      ) {
        this.shopInfo.isInMarketTwoPrice = true;
      }
    },
    //获取商品详情
    getShopInfo() {
      utilJs.getMethod(
        global.apiurl + "goods/goodsDetail?mgId=" + shopNo + '&isSkeleton=1',
        res => {
          this.companyAuth = JSON.parse(localStorage.getItem("companyAuth"));
          if (res.status == "error") {
            this.$routerGo(this, "replace", {
              path: "/error/emptyPage",
              query: {
                from: "MALL",
                info: res.msg
              }
            });
            return;
          }
          this.recommendList = res.relatedGoods;
          this.agentConfs = res.agentConfs;
          res.goods.prodType = 12; // 区分prodType
          this.shopInfo = res.goods;
          this.commonProdInfo = res.commonProdInfo;
          this.shopInfo.commonProdInfo = res.commonProdInfo;
          this.shopInfo.deductiblePoints = res.goods.pointsDeduct;
          this.guideData = res.goods.guideData || null;
          this.optimal = res.goods.optimal || null;
          this.$nextTick(() => {
            const showGuideId = localStorage.getItem(`showGuideId`) || 0;
            // 第一次且是购买页返回
            if (this.$refs.guidance && this.guideData && this.guideData.isOpenGuide == 1 && this.guideData.guideType.includes(3) && showGuideId == shopNo) {
              utilJs.getLeadSocialLog(this.cfrom.shopping, shopNo).then(dataRes => {
                if (!dataRes || dataRes == '') {
                  this.$refs.guidance.isShowPop();
                  utilJs.saveLeadSocialLog(this.cfrom.shopping, shopNo)
                }
              })
            }
            localStorage.removeItem(`showGuideId`)
          })

          this.shareSetting = res.shareSetting;
          this.relData = res.goods.relData;
          this.hasRelDate = true;
          this.cashBack = !res.cashBack || (res.cashBack && res.cashBack.length == 0) ? null : res.cashBack;
          this.minOrderQuantity = res.goods.minOrderQuantity ? res.goods.minOrderQuantity : 1;
          this.defultBuyNum = this.minOrderQuantity;
          this.selectShopNum = this.minOrderQuantity;
          this.vipType = res.user ? res.user.vipType : '';
          this.cartNum = res.cartNum;
          this.tags = res.tags;
          this.flashSales = res.flashSales;
          this.collageInfo = res.collage;
          this.bargain = res.bargain;
          this.enableChainModel = res.enableChainModel;
          this.isMallOfflineDeliver = res.goods.isMallOfflineDeliver ? res.goods.isMallOfflineDeliver : -1;
          this.isMallExpressDeliver = res.goods.isMallExpressDeliver ? res.goods.isMallExpressDeliver : -1;
          this.isHideDiscountInfo = res.isHideDiscountInfo;
          // 判断是否关联表单
          this.collectPage = res.collectPage;
          this.isRelForm = res.isRelForm;
          this.hasFormLog = res.hasFormLog;
          this.enableEdit = res.enableEdit;
          this.isAssociatedForm = res.collectPage != 3 && res.collectPage == 1 && res.isRelForm == true && res.hasFormLog == false && localStorage.getItem("showForm") == 1;
          this.attributeInfo = res.goods.attributes && res.goods.attributes.some(item => item.k && item.v) ? res.goods.attributes : [];
          this.freeShipping = res.freeShipping;
          this.swiperList = res.banners;
          if (this.swiperList.length == 1) {
            this.swiperOption.autoplay = false;
            this.swiperOption.loop = false;
          }
          this.videoInfo = res.videoInfo;
          if (res.videoInfo) {
            let itemUrl = {
              "url": res.videoInfo.videoAvatar
            };
            this.swiperList.unshift(itemUrl);
            this.currentVideoObj = {
              videoSrc: res.videoInfo.videoMp4,
              m3u8Url: res.videoInfo.videoM3u8
            }
          }
          this.specs = res.specs;
          this.specItems = res.specItems;
          this.specItemInfos = res.specItemInfos;
          this.defaltSpec = res.goods.defaltSpec;
          // 当前身份折扣
          this.currentDiscount = this.vipType == 2 ? this.shopInfo.vipDiscount * 1 :
                                 this.vipType == 4 ? this.shopInfo.svipDiscount * 1 :
                                 this.vipType == 3 || this.vipType > 4 && this.commonProdInfo ? this.commonProdInfo.agentDiscount * 1 :
                                 this.shopInfo.vipDiscountType == 1 ? 100 : res.goods.price * 1;
          // 获取链动价格
          this.chainPrice = this.isChainProd ?
                            (
                              (this.chainInfo.isReorder && this.chainInfo.enableReorderDiscount == 1 && this.chainInfo.reorderBonus * 1 != this.shopInfo.price * 1) ? this.chainInfo.reorderBonus * 1 :
                              (this.chainInfo.enableOrderDiscount == 1 && this.chainInfo.orderBonus * 1 != this.shopInfo.price * 1) ? this.chainInfo.orderBonus * 1 : res.goods.price * 1
                            ) : res.goods.price * 1;
          if (this.specItemInfos && this.specItemInfos.length == 0) {
            let currentPrice = res.goods.price * 1, discountPrice = res.goods.price * 1;
            discountPrice = this.shopInfo.vipDiscountType == 1 ? Number(currentPrice * 1 * this.currentDiscount / 100).toFixed(2) : Number(this.currentDiscount).toFixed(2);
            currentPrice = this.chainPrice <= discountPrice ? this.chainPrice : discountPrice;
            this.showPrice = Number(currentPrice).toFixed(2);
            this.showOriginalPrice = res.goods.originalPrice;
            this.selectTypeImg = this.shopInfo.avatar ? this.shopInfo.avatar : this.swiperList.length > 0 ? this.swiperList[0].url : '';
            this.dialogStock = this.shopInfo.stock;
            this.currentSpecDeposit = res.presale ? res.presale.deposit : 0;
          } else {
            // 商城多规格商品不支持参与链动2+1模式
            let defaltSpec = this.specItemInfos.find(item => item.itemGroup == "[" + this.defaltSpec + "]");
            let discountPrice = defaltSpec ? defaltSpec.price : res.goods.price;
            discountPrice = this.shopInfo.vipDiscountType == 1 ? Number(discountPrice * 1 * this.currentDiscount / 100).toFixed(2) : Number(this.currentDiscount).toFixed(2);
            this.showPrice = discountPrice;
            this.showOriginalPrice = defaltSpec ? defaltSpec.originalPrice : res.goods.originalPrice;
            this.dialogStock = defaltSpec ? defaltSpec.stock : this.shopInfo.stock;
            this.selectTypeImg = defaltSpec && defaltSpec.gsiPicture ? defaltSpec.gsiPicture : (this.shopInfo.avatar ? this.shopInfo.avatar : this.swiperList.length > 0 ? this.swiperList[0].url : '');
            if (defaltSpec && res.presale) {
              this.currentSpecInfo = defaltSpec;
              this.currentSpecDeposit = defaltSpec.deposit;
            }
          }
          this.selectTypeIndex = [];
          let specInfo = "";
          for (let i = 0; i < res.specs.length; i++) {
            specInfo += res.specs[i].name + " ";
          }
          this.specInfo = specInfo;
          this.selectTypeIndex = this.defaltSpec ? this.defaltSpec : [];
          // 限时购
          if (res.flashSales != null && res.flashSales.status && this.companyAuth.enableFlashSalesModule == 1) {
            let nt = (new Date()).getTime();
            let st = utilJs.getTimeByDate(res.flashSales.sales.startTime);
            let et = utilJs.getTimeByDate(res.flashSales.sales.endTime);
            if (nt >= st && nt < et && res.flashSales.sales.status > -1) {
              this.flashSales.sales.status = 2;
            } else if (nt < st && res.flashSales.sales.status == 1) {
              this.flashSales.sales.status = 1;
            } else if (nt >= et && res.flashSales.sales.status == 2) {
              this.flashSales.sales.status = -1;
              this.flashSales = null;
            } else {
              this.flashSales = null;
            }
          } else {
            this.flashSales = null;
          }
          if (this.flashSales && this.flashSales.sales.status == 2 && this.flashSales.limit != 0 && res.specItemInfos.length == 0) {
            this.showSalesStock = this.flashSales.limit - res.goods.buyCount;
          }
          if (this.collageInfo && this.collageInfo.status == 2 && this.collageInfo.isLimit == 1 && res.specItemInfos.length == 0) {
            this.showCollageStock = this.collageInfo.buyCount;
          }
          if (this.flashSales) {
            this.flashPrice = this.flashSales.price;
            this.showOriginalPrice = res.goods.price;
            if (this.flashSales.sales) {
              this.isSalesBegin = (this.flashSales.sales.startTime).replace(/\s+|[-]|[:]/g, "") <= (utilJs.getNowTime()).replace(/\s+|[-]|[:]/g, "") ? true : false;
            }
          }

          // 拼团
          if (this.collageInfo) {
            this.collageOriginalPrice = res.goods.price;
            if (this.specItemInfos && this.specItemInfos.length > 0) {
              let specInfo = this.specItemInfos.find(item => item.itemGroup == "[" + this.defaltSpec + "]");
              this.collagePrice = specInfo.captainPrice ? specInfo.captainPrice : this.showPrice;
              this.collagePlayerPrice = specInfo.playersPrice ? specInfo.playersPrice : this.showPrice;
            } else {
              this.collagePrice = this.collageInfo.captainPrice ? this.collageInfo.captainPrice : this.showPrice;
              this.collagePlayerPrice = this.collageInfo.playersPrice ? this.collageInfo.playersPrice : this.showPrice;
            }
          }
          if (this.collageInfo && this.companyAuth.enableCollage == 1) {
            let nt = new Date().getTime();
            let st = utilJs.getTimeByDate(this.collageInfo.startTime);
            let et = utilJs.getTimeByDate(this.collageInfo.endTime);
            if (nt >= st && nt < et && this.collageInfo.status > -1) {
              this.collageInfo.status = 2;
            } else if (nt < st && this.collageInfo.status == 1) {
              this.collageInfo.status = 1;
            } else if (nt >= et && this.collageInfo.status == 2) {
              this.collageInfo.status = -1;
              this.collageInfo = null;
            } else {
              this.collageInfo = null;
            }
          }
          this.isInCollage = this.checkIsInCollage();
          this.isInFlashSales = this.checkIsInFlashSales();
          // 预售
          if (res.presale) {
            this.presale = res.presale;
            this.showPrice = res.presale.aPrice;
            this.showOriginalPrice = res.presale.oPrice;
            this.optimal = null;
          }
          // 设置商城隐藏对普通用户展示优惠价格
          if (this.isHideDiscountInfo == 1) {
            this.$set(this.shopInfo, 'vipDiscount', (this.vipType != 2 ? (this.shopInfo.vipDiscountType == 1 ? 100 : this.showPrice) : this.shopInfo.vipDiscount));
            this.$set(this.shopInfo, 'svipDiscount', (this.vipType != 4 ? (this.shopInfo.vipDiscountType == 1 ? 100 : this.showPrice) : this.shopInfo.svipDiscount));
          }
          this.shopInfo.isMarket = this.showMarketingBar;
          // 初始化规格信息
          this.initSpecInfo();
          // 获取服务商信息
          this.$nextTick(() => {
            this.$refs.descriptions.getDescptionDetail();
          })
          // 商品填写表单回来后 弹窗规格选择(单规格、多规格都展示)
          if (sessionStorage.getItem('specsType')) {
            this.clickButtonType = sessionStorage.getItem('specsType') == 1 ? "BUY" : "CAR";
            sessionStorage.removeItem('specsType');
            this.initSpecData(); // 初始化购物车数据
            this.showSpecifications = true;
          }
          // 微信分享
          this.wechatShare();
          utilJs.appShare(this);
        }
      );
    },
    initData() {
      this.swiperIndex = 0; //轮播图index
      this.showVideo = false;
      this.showShareMoneyTip = true;
      this.specItemInfos = [];
      shopNo = this.$route.query.ShopNo || this.$route.query.shopNo; // 参数可能有旧链接是大驼峰参数
      this.shopInfo = {};
      this.swiperList = [];
      this.tabActive = "SHOP";
      this.showBackTop = false;
      this.showServer = false;
      this.isShowShare = false;
      this.showSpecifications = false;
      this.defaltSpec = [0, 0]; //默认最低价格规格索引
      this.isChangeSelectType = false; //判断索引是否改变
      this.selectTypeImg = ''; //当前规格图片
      this.selectTypeIndex = [0, 0];
      this.selectTypeInfo = ""; //选择商品规格类型结果
      this.specInfo = "";
      this.specs = []; //商品规格一级分类
      this.specItems = []; //商品规格二级分类
      this.dialogPrice = ""; //选择商品规格结果价格
      this.dialogOriginalPrice = ""; //选择商品规格结果价格
      this.dialogStock = ""; //选择商品规格结果库存
      this.dialogGsiiId = ""; //选择商品规则结果ID
      this.minOrderQuantity = 1;
      this.selectShopNum = 1;
      this.defultBuyNum = 1;
      this.clickButtonType = "SPEC";
      this.flashSales = null;
      this.couponPage = 1;
      this.couponIsPage = false;
      this.couponLoading = false;
      this.showCoupon = false;
      this.couponList = [];
      this.showPostage = false;
      this.tabIndex = 0;
      this.cloroRGB = THEME_RGB_MAP[this.theme];
      this.isAssociatedForm = false;
      this.bargain = null;
      this.showAccountQcode = false;
      this.mpQrcode = '';
      this.presale = null;
      this.currentSpecDeposit = 0;
      this.currentSpecInfo = null;
      this.selectTypeInfoTxt = '';
      this.shareSetting = null;
      this.optimal = null;
      this.currentDiscount = null;
      this.chainPrice = null; // 链动价格
      this.flashPrice = '';
      utilJs.getChainInfo(global.ckFrom.shopping, shopNo).then(res => {
        this.chainInfo = res;
        this.isChainProd = this.chainInfo && this.chainInfo.isChainProd;
      });
      getBindPhoneSetting(global.ckFrom.shopping).then(res => {
        this.bindPhoneSetting = res;
      });
      this.getShopInfo();
      this.getCouponList();
      this.getShopComments();
    },
    goCommentList() {
      if (this.commentsTotal == 0) {
        return
      }
      this.$routerGo(this, "push", {
        path: '/mall/shopComments/shopCommentList',
        query: ({ shopNo: shopNo, type: 1 })
      })
    },
    nameLength(name, length) {
      return utilJs.nameLength(name, length)
    },
    // 获取商城评论
    getShopComments() {
      utilJs.getMethod(global.apiurl + "goods/getComment/" + this.ShopId + '?limit=1&type=1&page=1', res => {
        if (!res.comment.data || (res.comment.data && res.comment.data.length <= 0)) return
        this.shopTopComment = res.comment.data[0];
        this.commentsTotal = res.comment.total || 0;
        let createTime = this.shopTopComment.createdAt.split(" ");
        this.$set(this.shopTopComment, 'createdAt', createTime[0]);
      })
    },
    getGroupData() {
      utilJs.getMethod(global.apiurl + "mallCollage/getGroupData?groupId=" + this.groupId, res => {
        this.groupInfo = res;
        if (this.groupInfo.joinStatus == 1 ||
          (this.groupInfo.status == 1 && this.groupInfo.joinStatus == 1) ||
          (this.groupInfo.status == 4 && this.groupInfo.joinStatus == 1)
        ) {
          this.$routerGo(this, "push", {
            path: "/homePage/collage/collageDetail",
            query: { isMall: 1, orderId: this.groupInfo.orderId }
          });
        } else {
          let showText = this.groupInfo.status == 1 && this.groupInfo.joinStatus == 0 ? '此团已成团,请参与其它团' : this.groupInfo.status == 3 ? '此团已失效,请参与其它团' : '此团已过期,请参与其它团';
          if (((this.groupInfo.status == 1 || this.groupInfo.status == 4) && this.groupInfo.joinStatus == 0) || this.groupInfo.status == 3) {
            this.$showCjToast({
              text: showText,
              type: 'warn'
            });
          }
          this.initData();
        }
      })
    },
    //手机端分享
    appShare: function () {
      let shareTitle = this.shareSetting ? this.shareSetting.shareTitle : this.shopInfo.name;
      let sharePic = this.shareSetting ? this.shareSetting.sharePic : this.shopInfo.avatar ? this.shopInfo.avatar : (this.swiperList.length > 0 ? this.swiperList[0].url : window.localStorage.getItem("shareLogo"));
      let shareDesc = this.shareSetting ? this.shareSetting.shareDesc : (this.shopInfo.shareDesc ? this.shopInfo.shareDesc : window.localStorage.getItem("shareDesc"));
      let title = this.presale ? this.presale.shareTitle : this.flashSales && this.flashSales.sales ? '【限时抢购】' + shareTitle : this.collageInfo ? '【邀您一起拼团】' + shareTitle : shareTitle;
      let shareImg = this.presale ? this.presale.sharePic : this.flashSales ? this.flashSales.shareImg : sharePic;
      let desc = this.presale ? this.presale.shareDesc : this.collageInfo ? this.collageInfo.shareDesc : shareDesc;
      let uh = window.location.href.split("#")[0];
      let shareUrl = uh + "#/mall/shopDetail/shopDetail?shopNo=" + shopNo + "&refereeId=" + localStorage.getItem("userId");
      utilJs.appShareTrue(title, shareImg, shareUrl, desc);
    },
    //分享
    wechatShare() {
      let shareTitle = this.shareSetting ? this.shareSetting.shareTitle : this.shopInfo.name;
      let sharePic = this.shareSetting ? this.shareSetting.sharePic : this.shopInfo.avatar ? this.shopInfo.avatar : (this.swiperList.length > 0 ? this.swiperList[0].url : window.localStorage.getItem("shareLogo"));
      let shareDesc = this.shareSetting ? this.shareSetting.shareDesc : (this.shopInfo.shareDesc ? this.shopInfo.shareDesc : window.localStorage.getItem("shareDesc"));
      let title = this.presale ? this.presale.shareTitle : this.flashSales && this.flashSales.sales ? '【限时抢购】' + shareTitle : this.collageInfo ? '【邀您一起拼团】' + shareTitle : shareTitle;
      let shareImg = this.presale ? this.presale.sharePic : this.flashSales ? this.flashSales.shareImg : sharePic;
      let desc = this.presale ? this.presale.shareDesc : this.collageInfo ? this.collageInfo.shareDesc : shareDesc;
      let uh = window.location.href.split("#")[0];
      let shareUrl = uh + "#/mall/shopDetail/shopDetail?shopNo=" + shopNo + "&refereeId=" + localStorage.getItem("userId");
      utilJs.wechatConfig(shareUrl, title, shareImg, desc, function () { });
    },
  },
  activated() {
    setDocumentTitle("商品详情");// eslint-disable-line
    this.showRelData = false;
    this.ShopId = this.$route.query.shopNo || this.$route.query.ShopNo; // 参数可能有旧链接是大驼峰参数
    this.groupInfo = '';
    this.groupId = this.$route.query.groupId;
    this.joinGroupId = "";
    this.goodsRoomId = this.$route.query.goodsRoomId || '';
    this.isPlayer = false;
    this.showHideOnBlur = false;
    this.isMallOfflineDeliver = 0;
    this.isMallExpressDeliver = 0;
    this.collageList = [];
    this.is_collagePage = false;
    this.collagePage = 1;
    this.cashBack = null;
    this.buyerSwiperList = [];
    this.shopTopComment = null;
    this.commentsTotal = 0;
    this.isHideDiscountInfo = -1;
    this.guideData = null;
    this.presale = null;
    this.currentSpecDeposit = 0;
    this.currentSpecInfo = null;
    this.chainInfo = '';
    this.isChainProd = false;
    isFromInteract = this.$route.query.isFromInteract ? true : false;
    if (this.$route.query.fromCollageInvite && this.groupId) {
      this.getGroupData();
    } else {
      this.initData();
    }
    this.buyedInfoSwiper();
  },
  deactivated() {
    let curClassName = document
      .getElementsByTagName("body")[0]
      .className.replace("open-disabled-scroll", "");
    document.getElementsByTagName("body")[0].className = curClassName;
  }
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->

<style scoped>
.shop-top {
  height: 2.15rem;
  width: 100%;
  border-bottom: 1px solid #d2d2d2;
  display: flex;
  display: -webkit-flex;
  align-items: center;
  -webkit-align-items: center;
}

.shop-buy-item {
  height: 2.15rem;
  width: 100%;
  bottom: 0;
  position: fixed;
  display: flex;
  display: -webkit-flex;
  background-color: #fff;
  max-width: 640px;
  z-index: 11;
}
.masker-content {
  background-color: #fff;
  max-height: 16rem;
  height: 16rem;
  width: 100%;
  /* position: fixed;
  bottom: 0;
  z-index: 1003; */
}
.masker {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1002;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.4);
}
.content-scroll {
  height: 14rem;
  overflow-y: auto;
  padding-bottom: 2rem;
  -webkit-overflow-scrolling: touch;
}
.masker-specifications-content {
  background-color: #fff;
  max-height: 16rem;
  height: 16rem;
  width: 100%;
  /* position: fixed;
  bottom: 0;
  z-index: 1003; */
}
.masker-content-img {
  width: 3.45rem;
  max-height: 3.45rem;
}
.swiper-img-tag {
  width: 3.2rem;
  background-color: rgba(0, 0, 0, 0.25);
  border-radius: 0.1rem;
  height: 1.05rem;
}
.swiper-page-tag {
  width: 1.35rem;
  background:rgba(0,0,0,0.4);
  border-radius: 0.5rem;
  height: 0.7rem;
  color: #fff;
}
video::-internal-media-controls-download-button {
    display:none;
}
video::-webkit-media-controls-enclosure {
    overflow:hidden;
}
video::-webkit-media-controls-panel {
    width: calc(100% + 30px);
}
#picScroll {
  overflow: scroll;
  -webkit-overflow-scrolling: touch;
}
.C-hh160 {
  height: 4rem;
}
.sPoints>span {
  position: relative;
}
.sPoints>span::before {
  position: absolute;
  content: "";
  height: 2px;
  width: 2px;
  border-radius: 50%;
  background: #333;
  top: calc(50% - 1px);
  left: -0.3rem;
}
.sPoints>span:first-child:before {
  display: none;
}
.masker-content1 {
  background-color: #fff;
  max-height: 8.25rem;
  height: 8.25rem;
  width: 100%;
}
.c-tibg{
  background: rgba(255,48,12,0.1);
}
.closeBig >>> p > img,
.closeBig >>> section > img,
.closeBig >>> div > img,
.closeBig >>> img {
  pointer-events: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -webkit-user-select: none;
  -o-user-select: none;
  user-select: none;
}
.aCloseBig >>> p > a > img,
.aCloseBig >>> section > a > img,
.aCloseBig >>> div > a > img {
  pointer-events: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -webkit-user-select: none;
  -o-user-select: none;
  user-select: none;
}
/* .sPointsBefore{
  display: inline-block;
  width: 0.71rem;
  height: 0.24rem;
  background: -webkit-gradient(linear,right top,left top,#fff, rgba(255,255,255,0));
  background: linear-gradient(270deg,#fff, rgba(255,255,255,0));
} */
.shopDetail /deep/ .priceBar {
  padding-left: 0;
  padding-right: 0;
}
.camp-guide {
  background: url("../../../assets/i/wap/course/group_guidance_bg.png") no-repeat;
  background-size: 100% 100%;
}
.fc-D8D8D8 {
  color: #D8D8D8;
}
.fc-3F73F8 {
    color: #3F73F8;
}
.bd1-f5 {
  border: 1px solid #f5f5f5;
}
.cjpopBg{
  background-image: linear-gradient(90deg, #FCDDBF 0%, #FFEEDC 39%, #FFF3E5 73%, #FEDABC 100%);
}
.custom-table {
  width: 100%;
  border-collapse: collapse;
  border: 0.05rem solid #E7E7E7;
}

.custom-table td {
  padding: 0.375rem 0.55rem;
  color: #999999;
  line-height: 0.8rem;
  font-size: 0.55rem;
}
.bd-b1-E7E7E7 {
  border-bottom: 0.05rem solid #E7E7E7;
}
.bd-r1-E7E7E7 {
  border-right: 0.05rem solid #E7E7E7;
}
.ww154 {
  width: 3.85rem;
}
</style>


